Class AbstractMarkedContentNode<C extends AbstractMarkedContentNode<C,N,M>,N extends Node,M extends Mark>
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<C>
-
- com.atlassian.adf.model.node.AbstractContentNode<C,N>
-
- com.atlassian.adf.model.node.AbstractMarkedContentNode<C,N,M>
-
- All Implemented Interfaces:
Element,Node,ContentNode<C,N>,Marked<C,M>
- Direct Known Subclasses:
BodiedExtension,CodeBlock,Expand,Heading,LayoutSection,Paragraph,Table
@Internal public abstract class AbstractMarkedContentNode<C extends AbstractMarkedContentNode<C,N,M>,N extends Node,M extends Mark> extends AbstractContentNode<C,N> implements ContentNode<C,N>, Marked<C,M>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.adf.model.node.AbstractNode
AbstractNode.ToStringHelper
-
-
Field Summary
Fields Modifier and Type Field Description protected com.atlassian.adf.model.node.MarkHolder<M>marks-
Fields inherited from class com.atlassian.adf.model.node.AbstractContentNode
content
-
-
Method Summary
All Methods Instance Methods Abstract 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.protected voidappendMarkedContentNodeFields(AbstractNode.ToStringHelper buf)protected booleancontentNodeEquals(C 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.protected voidcontentNodeValidate()protected com.atlassian.adf.model.node.MarkHolder<M>createMarkHolder()Optional<M>mark(String markType)Returns the existing mark of the given type, if it exists.Cmark(M mark)Adds the given mark to this marked node.abstract Class<M>markClass()Returns the type of marks that may be applied to this node.protected booleanmarkedContentNodeEquals(C other)protected intmarkedContentNodeHashCode()protected voidmarkedContentNodeValidate()Collection<M>marks()Returns a list of the marks currently assigned to this node.<T extends M>
Stream<? extends T>marks(Class<T> markClass)Returns a stream of the marks that are currently assigned to this node and match the given type.Set<String>markTypes()Returns a set of all themark typesthat have been assigned to this node.protected CparseMarks(Map<String,?> map)protected Factory<M>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, contentClass, copy, isEmpty, removeIf, replaceContent, transformContent, transformDescendants
-
Methods inherited from interface com.atlassian.adf.model.Element
elementType, isSupported, toMap, validate
-
Methods inherited from interface com.atlassian.adf.model.node.Node
appendPlainText, toPlainText
-
-
-
-
Method Detail
-
markClass
public abstract Class<M> markClass()
Description copied from interface:MarkedReturns the type of marks that may be applied to this node.
-
createMarkHolder
protected com.atlassian.adf.model.node.MarkHolder<M> createMarkHolder()
-
marks
public final Collection<M> marks()
Description copied from interface:MarkedReturns a list of the marks currently assigned to this node.
-
markTypes
public final Set<String> markTypes()
Description copied from interface:MarkedReturns a set of all themark typesthat have been assigned to this node.- Specified by:
markTypesin interfaceMarked<C extends AbstractMarkedContentNode<C,N,M>,N extends Node>- Returns:
- a set of all the
mark typesthat have been assigned to this node.
-
marks
public final <T extends M> Stream<? extends T> marks(Class<T> markClass)
Description copied from interface:MarkedReturns a stream of the marks that are currently assigned to this node and match the given type.Since only one mark of each type is permitted to be assigned to a single node, the stream will not contain multiple elements when
markClassis a concrete mark class.
-
mark
public final Optional<M> mark(String markType)
Description copied from interface:MarkedReturns the existing mark of the given type, if it exists.
-
mark
public C mark(M mark)
Description copied from interface:MarkedAdds the given mark to this marked node.
-
contentNodeValidate
protected final void contentNodeValidate()
- Overrides:
contentNodeValidatein classAbstractContentNode<C extends AbstractMarkedContentNode<C,N,M>,N extends Node>
-
markedContentNodeValidate
protected void markedContentNodeValidate()
-
contentNodeHashCode
protected final 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<C extends AbstractMarkedContentNode<C,N,M>,N extends Node>- 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)
-
contentNodeEquals
protected final boolean contentNodeEquals(C 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<C extends AbstractMarkedContentNode<C,N,M>,N extends Node>- 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)
-
appendContentNodeFields
protected final 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<C extends AbstractMarkedContentNode<C,N,M>,N extends Node>- Parameters:
buf- where the field values should be written- See Also:
AbstractContentNode.contentNodeHashCode(),AbstractContentNode.contentNodeEquals(AbstractContentNode)
-
markedContentNodeHashCode
protected int markedContentNodeHashCode()
-
markedContentNodeEquals
protected boolean markedContentNodeEquals(C other)
-
appendMarkedContentNodeFields
protected void appendMarkedContentNodeFields(AbstractNode.ToStringHelper buf)
-
-