Class Paragraph

    • Method Detail

      • p

        public static Paragraph p()
        Returns:
        a new, empty paragraph
      • p

        public static Paragraph p​(String content)
        Returns:
        a new paragraph with the given content
      • p

        public static Paragraph p​(String... content)
        Creates a new paragraph with the given content, all within that single paragraph. This is so that a long paragraph can be nicely split over multiple lines without having to concatenate them manually. Each is assigned its own Text node, but they are all assigned as content within the same containing paragraph.
        Returns:
        a new paragraph with the given content
      • paragraph

        public static Paragraph paragraph()
        See Also:
        p()
      • text

        public Paragraph text​(String content)
        Convenience method for appending an ordinary text node to this paragraph.

        This is equivalent to:

        
         content(text(content))
         
        Parameters:
        content - the text to add as an ordinary text node
        Returns:
        this
      • text

        public Paragraph text​(String content,
                              TextMark mark)
        Convenience method for appending an text node with a single mark to this paragraph.

        This is equivalent to:

        
         content(
                 text(content)
                         .mark(mark)
         );
         
        Parameters:
        content - the text to add as an ordinary text node
        Returns:
        this
      • text

        public Paragraph text​(String content,
                              TextMark... marks)
        Convenience method for appending an text node with multiple marks to this paragraph.

        This is equivalent to:

        
         content(text(content, marks));
         
        Parameters:
        content - the text to add as an ordinary text node
        Returns:
        this
      • text

        public Paragraph text​(String... content)
        Convenience method for appending multiple ordinary text nodes to this paragraph.

        This is equivalent to:

        
         content(text(content))
         
        Parameters:
        content - the text to add as an ordinary text node
        Returns:
        this
      • indentation

        public Paragraph indentation​(int level)
      • copy

        public Paragraph copy()
        Description copied from interface: Element
        Returns a deep copy of this element, including copies of any nodes or marks that it contains. The copy will not necessarily be in exactly the same state as the original in some cases. For example, a text node that is used inside a codeBlock will have the ability to use marks on it disabled, but a copy made of the text node using this method will not similarly disallow marks unless it is also added to a content node with those same restrictions.

        Implementations notes:

        • Implementations should narrow the return type.
        • Implementations should return this if the element is immutable. The @Immutable annotation should be used on the class to offer additional confirmation of this intent.
        • Implementations should return parse(toMap()) if they have state.
        • While there may be cases where it is worthwhile to do something more efficient than the conversion to a map and back, this is discouraged because it would add yet another fragile piece of code that breaks when new data is added to the node. The parse and toMap methods already have to be updated in these circumstances, so it makes sense to take advantage of that.
        Specified by:
        copy in interface ContentNode<Paragraph,​InlineContent>
        Specified by:
        copy in interface Element
        Specified by:
        copy in interface Marked<Paragraph,​ParagraphMark>
        Specified by:
        copy in interface Node
        Returns:
        a copy of this element, or this if the element is immutable anyway
      • elementType

        public String elementType()
        Description copied from interface: Element
        The type value that identifies this element, such as "paragraph" or "strong".
        Specified by:
        elementType in interface Element
      • toMap

        public Map<String,​?> toMap()
        Description copied from interface: Element
        Transforms this element to a map of String values to various basic object types suitable for direct rendering as JSON content.
        Specified by:
        toMap in interface Element
        Returns:
        the map representation of this ADF element
      • appendPlainText

        public void appendPlainText​(StringBuilder sb)
        Description copied from interface: Node
        Renders this node as plain-text suitable for viewing by end users. This is equivalent to calling Node.toPlainText() and appending the result to the given buffer, except that it may be slightly more efficient, since it will write directly to the existing buffer instead of using a temporary buffer and having to make a copy of the result.
        Specified by:
        appendPlainText in interface Node
        Overrides:
        appendPlainText in class AbstractContentNode<Paragraph,​InlineContent>
        Parameters:
        sb - where to write the result