Package com.atlassian.adf.model.node
Class Heading
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<C>
-
- com.atlassian.adf.model.node.AbstractContentNode<C,N>
-
- com.atlassian.adf.model.node.AbstractMarkedContentNode<Heading,InlineContent,HeadingMark>
-
- com.atlassian.adf.model.node.Heading
-
- All Implemented Interfaces:
Element,Node,ContentNode<Heading,InlineContent>,DocContent,LayoutColumnContent,Marked<Heading,HeadingMark>,NestedExpandContent,NonNestableBlockContent,PanelContent,TableCellContent
public class Heading extends AbstractMarkedContentNode<Heading,InlineContent,HeadingMark> implements DocContent, LayoutColumnContent, NestedExpandContent, NonNestableBlockContent, PanelContent, TableCellContent
Represents a topic heading, as for the<h1>through<h6>tags used in HTML.Example
Java
h4("Heading 4")ADF
{ "type": "heading", "attrs": { "level": 4 }, "content": [ { "type": "text", "text": "Heading 4" } ] }Result
Heading 4
- See Also:
- Node - heading
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.adf.model.node.AbstractNode
AbstractNode.ToStringHelper
-
-
Field Summary
-
Fields inherited from class com.atlassian.adf.model.node.AbstractMarkedContentNode
marks
-
Fields inherited from class com.atlassian.adf.model.node.AbstractContentNode
content
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendMarkedContentNodeFields(AbstractNode.ToStringHelper buf)Headingcenter()Headingcontent(String content)Adds the given string to this heading after first wrapping it as aTextnode.Headingcontent(String... content)Adds the given strings to this heading after first wrapping them asTextnodes.Class<InlineContent>contentClass()ReturnsClass<N>, the class representing the type of items held by this node.Headingcopy()Returns a deep copy of this element, including copies of any nodes or marks that it contains.StringelementType()Thetypevalue that identifies this element, such as"paragraph"or"strong".Headingend()static Headingh1()static Headingh1(InlineContent content)static Headingh1(InlineContent... content)static Headingh1(Iterable<? extends InlineContent> content)static Headingh1(String content)static Headingh1(String... content)static Headingh1(Stream<? extends InlineContent> content)static Headingh2()static Headingh2(InlineContent content)static Headingh2(InlineContent... content)static Headingh2(Iterable<? extends InlineContent> content)static Headingh2(String content)static Headingh2(String... content)static Headingh2(Stream<? extends InlineContent> content)static Headingh3()static Headingh3(InlineContent content)static Headingh3(InlineContent... content)static Headingh3(Iterable<? extends InlineContent> content)static Headingh3(String content)static Headingh3(String... content)static Headingh3(Stream<? extends InlineContent> content)static Headingh4()static Headingh4(InlineContent content)static Headingh4(InlineContent... content)static Headingh4(Iterable<? extends InlineContent> content)static Headingh4(String content)static Headingh4(String... content)static Headingh4(Stream<? extends InlineContent> content)static Headingh5()static Headingh5(InlineContent content)static Headingh5(InlineContent... content)static Headingh5(Iterable<? extends InlineContent> content)static Headingh5(String content)static Headingh5(String... content)static Headingh5(Stream<? extends InlineContent> content)static Headingh6()static Headingh6(InlineContent content)static Headingh6(InlineContent... content)static Headingh6(Iterable<? extends InlineContent> content)static Headingh6(String content)static Headingh6(String... content)static Headingh6(Stream<? extends InlineContent> content)static Headingheading(int level)static Headingheading(int level, InlineContent content)static Headingheading(int level, InlineContent... content)static Headingheading(int level, Iterable<? extends InlineContent> content)static Headingheading(int level, String content)static Headingheading(int level, String... content)static Headingheading(int level, Stream<? extends InlineContent> content)Headingindentation(int level)intlevel()Returns the heading level for this heading note, such as3for an<h3>heading.Headinglevel(int level)Headingmark(HeadingMark mark)Adds the given mark to this marked node.Class<HeadingMark>markClass()Returns the type of marks that may be applied to this node.protected booleanmarkedContentNodeEquals(Heading other)protected intmarkedContentNodeHashCode()Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.-
Methods inherited from class com.atlassian.adf.model.node.AbstractMarkedContentNode
appendContentNodeFields, contentNodeEquals, contentNodeHashCode, contentNodeValidate, createMarkHolder, mark, markedContentNodeValidate, marks, marks, markTypes, parseMarks, unsupportedMarkFactory
-
Methods inherited from class com.atlassian.adf.model.node.AbstractContentNode
addContent, addContentIfPresent, allNodes, appendNodeFields, appendPlainText, appendPlainTextContentJoinedWith, appendPlainTextInlineContent, clear, content, content, content, content, content, contentFieldMaps, isEmpty, nodeEquals, nodeHashCode, parseContentItem, parseContentItems, parseOptionalContent, parseRequiredContent, parseRequiredContentAllowEmpty, removeIf, replaceContent, requireNotEmpty, transformContent, transformDescendants, trim, validate, validateContentItems, validateContentNodeForAppend
-
Methods inherited from class com.atlassian.adf.model.node.AbstractNode
doubleEq, doubleHash, equals, hashCode, isSupported, mapWithType, numberEq, numberHash, self, toPlainText, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.atlassian.adf.model.node.type.ContentNode
allNodes, allNodesOfType, allNodesOfTypeAsList, clear, content, content, content, content, content, isEmpty, removeIf, replaceContent, transformContent, transformDescendants
-
Methods inherited from interface com.atlassian.adf.model.Element
isSupported, validate
-
Methods inherited from interface com.atlassian.adf.model.node.Node
appendPlainText, toPlainText
-
-
-
-
Method Detail
-
h1
public static Heading h1()
- Returns:
- a new, empty level 1 heading
-
h1
public static Heading h1(String... content)
- Returns:
- a new level 1 heading with the given content
-
h1
public static Heading h1(InlineContent content)
- Returns:
- a new level 1 heading with the given content
-
h1
public static Heading h1(InlineContent... content)
- Returns:
- a new level 1 heading with the given content
-
h1
public static Heading h1(Iterable<? extends InlineContent> content)
- Returns:
- a new level 1 heading with the given content
-
h1
public static Heading h1(Stream<? extends InlineContent> content)
- Returns:
- a new level 1 heading with the given content
-
h2
public static Heading h2()
- Returns:
- a new, empty level 2 heading
-
h2
public static Heading h2(String... content)
- Returns:
- a new level 2 heading with the given content
-
h2
public static Heading h2(InlineContent content)
- Returns:
- a new level 2 heading with the given content
-
h2
public static Heading h2(InlineContent... content)
- Returns:
- a new level 2 heading with the given content
-
h2
public static Heading h2(Iterable<? extends InlineContent> content)
- Returns:
- a new level 2 heading with the given content
-
h2
public static Heading h2(Stream<? extends InlineContent> content)
- Returns:
- a new level 2 heading with the given content
-
h3
public static Heading h3()
- Returns:
- a new, empty level 3 heading
-
h3
public static Heading h3(String... content)
- Returns:
- a new level 3 heading with the given content
-
h3
public static Heading h3(InlineContent content)
- Returns:
- a new level 3 heading with the given content
-
h3
public static Heading h3(InlineContent... content)
- Returns:
- a new level 3 heading with the given content
-
h3
public static Heading h3(Iterable<? extends InlineContent> content)
- Returns:
- a new level 3 heading with the given content
-
h3
public static Heading h3(Stream<? extends InlineContent> content)
- Returns:
- a new level 3 heading with the given content
-
h4
public static Heading h4()
- Returns:
- a new, empty level 4 heading
-
h4
public static Heading h4(String... content)
- Returns:
- a new level 4 heading with the given content
-
h4
public static Heading h4(InlineContent content)
- Returns:
- a new level 4 heading with the given content
-
h4
public static Heading h4(InlineContent... content)
- Returns:
- a new level 4 heading with the given content
-
h4
public static Heading h4(Iterable<? extends InlineContent> content)
- Returns:
- a new level 4 heading with the given content
-
h4
public static Heading h4(Stream<? extends InlineContent> content)
- Returns:
- a new level 4 heading with the given content
-
h5
public static Heading h5()
- Returns:
- a new, empty level 5 heading
-
h5
public static Heading h5(String... content)
- Returns:
- a new level 5 heading with the given content
-
h5
public static Heading h5(InlineContent content)
- Returns:
- a new level 5 heading with the given content
-
h5
public static Heading h5(InlineContent... content)
- Returns:
- a new level 5 heading with the given content
-
h5
public static Heading h5(Iterable<? extends InlineContent> content)
- Returns:
- a new level 5 heading with the given content
-
h5
public static Heading h5(Stream<? extends InlineContent> content)
- Returns:
- a new level 5 heading with the given content
-
h6
public static Heading h6()
- Returns:
- a new, empty level 6 heading
-
h6
public static Heading h6(String... content)
- Returns:
- a new level 6 heading with the given content
-
h6
public static Heading h6(InlineContent content)
- Returns:
- a new level 6 heading with the given content
-
h6
public static Heading h6(InlineContent... content)
- Returns:
- a new level 6 heading with the given content
-
h6
public static Heading h6(Iterable<? extends InlineContent> content)
- Returns:
- a new level 6 heading with the given content
-
h6
public static Heading h6(Stream<? extends InlineContent> content)
- Returns:
- a new level 6 heading with the given content
-
heading
public static Heading heading(int level)
- Parameters:
level- must be in the range1-6- Returns:
- a new, empty heading with the given level
-
heading
public static Heading heading(int level, String content)
- Parameters:
level- must be in the range1-6- Returns:
- a new heading with the given level and content
-
heading
public static Heading heading(int level, String... content)
- Parameters:
level- must be in the range1-6- Returns:
- a new heading with the given level and content
-
heading
public static Heading heading(int level, InlineContent content)
- Parameters:
level- must be in the range1-6- Returns:
- a new heading with the given level and content
-
heading
public static Heading heading(int level, InlineContent... content)
- Parameters:
level- must be in the range1-6- Returns:
- a new heading with the given level and content
-
heading
public static Heading heading(int level, Iterable<? extends InlineContent> content)
- Parameters:
level- must be in the range1-6- Returns:
- a new heading with the given level and content
-
heading
public static Heading heading(int level, Stream<? extends InlineContent> content)
- Parameters:
level- must be in the range1-6- Returns:
- a new heading with the given level and content
-
level
public Heading level(int level)
-
content
public Heading content(String content)
Adds the given string to this heading after first wrapping it as aTextnode.- Parameters:
content- the content to add- Returns:
this
-
content
public Heading content(String... content)
Adds the given strings to this heading after first wrapping them asTextnodes.- Parameters:
content- the content to add- Returns:
this
-
center
public Heading center()
-
end
public Heading end()
-
indentation
public Heading indentation(int level)
-
level
public int level()
Returns the heading level for this heading note, such as3for an<h3>heading.- Returns:
- the heading level for this heading note, such as
3for an<h3>heading.
-
mark
public Heading mark(HeadingMark mark)
Description copied from interface:MarkedAdds the given mark to this marked node.- Specified by:
markin interfaceMarked<Heading,HeadingMark>- Overrides:
markin classAbstractMarkedContentNode<Heading,InlineContent,HeadingMark>- Parameters:
mark- the mark to be added- Returns:
this
-
markClass
public Class<HeadingMark> markClass()
Description copied from interface:MarkedReturns the type of marks that may be applied to this node.- Specified by:
markClassin interfaceMarked<Heading,HeadingMark>- Specified by:
markClassin classAbstractMarkedContentNode<Heading,InlineContent,HeadingMark>- Returns:
- the type of marks that may be applied to this node, which is the concrete type for the generic
type
<M>on this interface.
-
contentClass
public Class<InlineContent> contentClass()
Description copied from interface:ContentNodeReturnsClass<N>, the class representing the type of items held by this node.- Specified by:
contentClassin interfaceContentNode<Heading,InlineContent>
-
copy
public Heading copy()
Description copied from interface:ElementReturns 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, atextnode that is used inside acodeBlockwill 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 thisif the element is immutable. The@Immutableannotation 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
parseandtoMapmethods already have to be updated in these circumstances, so it makes sense to take advantage of that.
- Specified by:
copyin interfaceContentNode<Heading,InlineContent>- Specified by:
copyin interfaceElement- Specified by:
copyin interfaceMarked<Heading,HeadingMark>- Specified by:
copyin interfaceNode- Returns:
- a copy of this element, or
thisif the element is immutable anyway
-
elementType
public String elementType()
Description copied from interface:ElementThetypevalue that identifies this element, such as"paragraph"or"strong".- Specified by:
elementTypein interfaceElement
-
markedContentNodeHashCode
protected int markedContentNodeHashCode()
- Overrides:
markedContentNodeHashCodein classAbstractMarkedContentNode<Heading,InlineContent,HeadingMark>
-
markedContentNodeEquals
protected boolean markedContentNodeEquals(Heading other)
- Overrides:
markedContentNodeEqualsin classAbstractMarkedContentNode<Heading,InlineContent,HeadingMark>
-
appendMarkedContentNodeFields
protected void appendMarkedContentNodeFields(AbstractNode.ToStringHelper buf)
- Overrides:
appendMarkedContentNodeFieldsin classAbstractMarkedContentNode<Heading,InlineContent,HeadingMark>
-
-