Class AbstractMarkedNode<N extends AbstractMarkedNode<N,​M>,​M extends Mark>

    • Field Detail

      • marks

        protected final com.atlassian.adf.model.node.MarkHolder<M extends Mark> marks
    • Method Detail

      • validate

        public final void validate()
        Description copied from interface: Element
        Verifies that the node is well-formed (including the state of any descendents that it has).
        Specified by:
        validate in interface Element
      • markedNodeValidate

        protected void markedNodeValidate()
      • copy

        public abstract N 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 Element
        Specified by:
        copy in interface Marked<N extends AbstractMarkedNode<N,​M>,​M extends Mark>
        Specified by:
        copy in interface Node
        Returns:
        a copy of this element, or this if the element is immutable anyway
      • markClass

        public abstract Class<M> markClass()
        Description copied from interface: Marked
        Returns the type of marks that may be applied to this node.
        Specified by:
        markClass in interface Marked<N extends AbstractMarkedNode<N,​M>,​M extends Mark>
        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.
      • createMarkHolder

        protected com.atlassian.adf.model.node.MarkHolder<M> createMarkHolder()
      • marks

        public final Collection<M> marks()
        Description copied from interface: Marked
        Returns a list of the marks currently assigned to this node.
        Specified by:
        marks in interface Marked<N extends AbstractMarkedNode<N,​M>,​M extends Mark>
        Returns:
        a list of the marks currently assigned to this node.
      • marks

        public final <T extends MStream<? extends T> marks​(Class<T> markClass)
        Description copied from interface: Marked
        Returns 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 markClass is a concrete mark class.

        Specified by:
        marks in interface Marked<N extends AbstractMarkedNode<N,​M>,​M extends Mark>
        Type Parameters:
        T - the inferred mark class
        Parameters:
        markClass - the mark types to be included in the stream
        Returns:
        the stream of matching marks
      • mark

        public final Optional<M> mark​(String type)
        Description copied from interface: Marked
        Returns the existing mark of the given type, if it exists.
        Specified by:
        mark in interface Marked<N extends AbstractMarkedNode<N,​M>,​M extends Mark>
        Parameters:
        type - the mark type to look up
        Returns:
        the existing mark, or empty if no such mark does exist
      • mark

        public N mark​(M mark)
        Description copied from interface: Marked
        Adds the given mark to this marked node.
        Specified by:
        mark in interface Marked<N extends AbstractMarkedNode<N,​M>,​M extends Mark>
        Parameters:
        mark - the mark to be added
        Returns:
        this
      • parseMarks

        protected N parseMarks​(Map<String,​?> map)
      • unsupportedMarkFactory

        @Nullable
        protected Factory<M> unsupportedMarkFactory()
      • markedNodeHashCode

        protected int markedNodeHashCode()
      • markedNodeEquals

        protected boolean markedNodeEquals​(N other)
      • nodeHashCode

        protected final int nodeHashCode()
        Description copied from class: AbstractNode
        Allows nodes that have their own fields to augment the hashCode implementation with a hash of their own field values.

        Implementations need not include the node's class; that is already covered by the AbstractNode.hashCode() implementation that is expected to be this method's only consumer.

        Just as with the relationship between hashCode, equals, and toString for ordinary Java classes, subclasses of AbstractNode should maintain consistent implementations of nodeHashCode, nodeEquals, and appendNodeFields.

        Overrides:
        nodeHashCode in class AbstractNode<N extends AbstractMarkedNode<N,​M>>
        Returns:
        the hash code of any additional field values that belong to a particular type of content node.
        See Also:
        AbstractNode.nodeEquals(AbstractNode), AbstractNode.appendNodeFields(ToStringHelper)
      • nodeEquals

        protected final boolean nodeEquals​(N other)
        Description copied from class: AbstractNode
        Allows nodes that have their own fields to augment the equals implementation with tests for their own field values.

        Implementations need not check for identity, null, or a different node class; those are already covered by the AbstractNode.equals(Object) implementation that is expected to be this method's only consumer.

        Just as with the relationship between hashCode, equals, and toString for ordinary Java classes, subclasses of AbstractNode should maintain consistent implementations of nodeHashCode, nodeEquals, and appendNodeFields.

        Overrides:
        nodeEquals in class AbstractNode<N extends AbstractMarkedNode<N,​M>>
        Returns:
        true if all additional field values that belong to a particular type of content node test as equal; false if differences are found
        See Also:
        AbstractNode.nodeHashCode(), AbstractNode.appendNodeFields(ToStringHelper)