Class OrderedList
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<C>
-
- com.atlassian.adf.model.node.AbstractContentNode<L,ListItem>
-
- com.atlassian.adf.model.node.AbstractListNode<OrderedList>
-
- com.atlassian.adf.model.node.OrderedList
-
- All Implemented Interfaces:
Element,Node,ContentNode<OrderedList,ListItem>,DocContent,LayoutColumnContent,ListItemContent,ListNode<OrderedList>,NonNestableBlockContent,PanelContent,TableCellContent
@Documentation(state=WRONG, date="2023-07-26", comment="the \'order\' may be 0, now") public class OrderedList extends AbstractListNode<OrderedList>
A container forlist itemsthat produces a numbered list of them.Example
Java
orderedList( 3,li("Hello"),li("World") );ADF
{ "type": "orderedList", "attrs": { "order": 3 }, "content": [ { "type": "listItem", "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Hello" } ] } ] }, { "type": "listItem", "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "World" } ] } ] } ] }Result
Hello
World
- See Also:
- Node - orderedList
-
-
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.AbstractContentNode
content
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendContentNodeFields(AbstractNode.ToStringHelper buf)Allows content nodes that have their own fields to augment thetoString()implementation with their own field values.voidappendPlainText(StringBuilder sb)Renders this node as plain-text suitable for viewing by end users.protected booleancontentNodeEquals(OrderedList other)Allows content nodes that have their own fields to augment theequalsimplementation with tests for their own field values.protected intcontentNodeHashCode()Allows content nodes that have their own fields to augment thehashCodeimplementation with a hash of their own field values.OrderedListcopy()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".static OrderedListol()static OrderedListol(int order)static OrderedListol(int order, ListItem... content)static OrderedListol(int order, Iterable<? extends ListItem> content)static OrderedListol(int order, Stream<? extends ListItem> content)static OrderedListol(ListItem... content)static OrderedListol(Iterable<? extends ListItem> content)static OrderedListol(Stream<? extends ListItem> content)Optional<Integer>order()Returns the ordinal of the initial value in the list, if set.OrderedListorder(Integer order)Changes the starting value for the list, which otherwise defaults to starting at1.static OrderedListorderedList()static OrderedListorderedList(int order)static OrderedListorderedList(int order, ListItem... content)static OrderedListorderedList(int order, Iterable<? extends ListItem> content)static OrderedListorderedList(int order, Stream<? extends ListItem> content)static OrderedListorderedList(ListItem... content)static OrderedListorderedList(Iterable<? extends ListItem> content)static OrderedListorderedList(Stream<? extends ListItem> content)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.AbstractListNode
contentClass, contentNodeValidate, li, li, li, li, li, li
-
Methods inherited from class com.atlassian.adf.model.node.AbstractContentNode
addContent, addContentIfPresent, allNodes, appendNodeFields, 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
toPlainText
-
-
-
-
Method Detail
-
ol
public static OrderedList ol()
- Returns:
- a new, empty ordered list. At least one list item must be added before it will be valid.
-
ol
public static OrderedList ol(ListItem... content)
- Returns:
- a new ordered list with the given contents
-
ol
public static OrderedList ol(Iterable<? extends ListItem> content)
- Returns:
- a new ordered list with the given contents
-
ol
public static OrderedList ol(Stream<? extends ListItem> content)
- Returns:
- a new ordered list with the given contents
-
ol
public static OrderedList ol(int order)
- Returns:
- a new, empty ordered list with the specified initial order. At least one list item must be added before it will be valid.
-
ol
public static OrderedList ol(int order, ListItem... content)
- Returns:
- a new ordered list with the specified initial order and contents.
-
ol
public static OrderedList ol(int order, Iterable<? extends ListItem> content)
- Returns:
- a new ordered list with the specified initial order and contents.
-
ol
public static OrderedList ol(int order, Stream<? extends ListItem> content)
- Returns:
- a new ordered list with the specified initial order and contents.
-
orderedList
public static OrderedList orderedList()
- See Also:
ol()
-
orderedList
public static OrderedList orderedList(ListItem... content)
- See Also:
ol(ListItem[])
-
orderedList
public static OrderedList orderedList(Iterable<? extends ListItem> content)
- See Also:
ol(Iterable)
-
orderedList
public static OrderedList orderedList(Stream<? extends ListItem> content)
- See Also:
ol(Stream)
-
orderedList
public static OrderedList orderedList(int order)
- See Also:
ol(int)
-
orderedList
public static OrderedList orderedList(int order, ListItem... content)
- See Also:
ol(int, ListItem[])
-
orderedList
public static OrderedList orderedList(int order, Iterable<? extends ListItem> content)
- See Also:
ol(int, Iterable)
-
orderedList
public static OrderedList orderedList(int order, Stream<? extends ListItem> content)
- See Also:
ol(int, Stream)
-
order
public Optional<Integer> order()
Returns the ordinal of the initial value in the list, if set.- Returns:
- the ordinal of the initial value in the list, or
empty()if not set.
-
order
public OrderedList order(@Nullable Integer order)
Changes the starting value for the list, which otherwise defaults to starting at1.- Parameters:
order- the positive integer to use as the starting point when numbering the list items- Returns:
this
-
copy
public OrderedList 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.
- 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".
-
toMap
public Map<String,?> toMap()
Description copied from interface:ElementTransforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.- Returns:
- the map representation of this ADF element
-
contentNodeEquals
protected boolean contentNodeEquals(OrderedList other)
Description copied from class:AbstractContentNodeAllows content nodes that have their own fields to augment theequalsimplementation with tests for their own field values.Implementations need not check for identity,
null, or a different node class; those are already covered byAbstractNode.equals(Object). Implementations need not check theAbstractContentNode.content(), either; that is already covered byAbstractContentNode.nodeEquals(AbstractContentNode), which is expected to be this method's only consumer.Just as with the relationship between
hashCode,equals, andtoStringfor ordinary Java classes, subclasses ofAbstractContentNodeshould maintain consistent implementations ofcontentNodeHashCode,contentNodeEquals, andappendContentNodeFields.- Overrides:
contentNodeEqualsin classAbstractContentNode<OrderedList,ListItem>- Returns:
trueif all additional field values that belong to a particular type of content node test as equal;falseif differences are found- See Also:
AbstractContentNode.contentNodeHashCode(),AbstractContentNode.appendContentNodeFields(ToStringHelper)
-
contentNodeHashCode
protected int contentNodeHashCode()
Description copied from class:AbstractContentNodeAllows content nodes that have their own fields to augment thehashCodeimplementation with a hash of their own field values.Implementations need not include the node's class; that is already covered by
AbstractNode.hashCode(). Implementations need not include thecontent, either; that is already covered byAbstractNode.nodeHashCode(), which is expected to be this method's only consumer.Just as with the relationship between
hashCode,equals, andtoStringfor ordinary Java classes, subclasses ofAbstractContentNodeshould maintain consistent implementations ofcontentNodeHashCode,contentNodeEquals, andappendContentNodeFields.- Overrides:
contentNodeHashCodein classAbstractContentNode<OrderedList,ListItem>- Returns:
- the hash code of any additional field values that belong to a particular type of content node.
- See Also:
AbstractContentNode.contentNodeEquals(AbstractContentNode),AbstractContentNode.appendContentNodeFields(ToStringHelper)
-
appendContentNodeFields
protected void appendContentNodeFields(AbstractNode.ToStringHelper buf)
Description copied from class:AbstractContentNodeAllows content nodes that have their own fields to augment thetoString()implementation with their own field values.Each field's value should be provided by calling
AbstractNode.ToStringHelper.appendField(String, Object). Thevaluemay benull, in which case the field is omitted, for brevity. It will handle array values gracefully, including arrays of primitive types.Just as with the relationship between
hashCode,equals, andtoStringfor ordinary Java classes, subclasses ofAbstractContentNodeshould maintain consistent implementations ofcontentNodeHashCode,contentNodeEquals, andappendContentNodeFields.- Overrides:
appendContentNodeFieldsin classAbstractContentNode<OrderedList,ListItem>- Parameters:
buf- where the field values should be written- See Also:
AbstractContentNode.contentNodeHashCode(),AbstractContentNode.contentNodeEquals(AbstractContentNode)
-
appendPlainText
public void appendPlainText(StringBuilder sb)
Description copied from interface:NodeRenders this node as plain-text suitable for viewing by end users. This is equivalent to callingNode.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:
appendPlainTextin interfaceNode- Overrides:
appendPlainTextin classAbstractContentNode<OrderedList,ListItem>- Parameters:
sb- where to write the result
-
-