Class Mention

    • Method Detail

      • mention

        public static Mention mention​(String id)
        Create a new mention using the given Atlassian Account ID or collection name.
        Parameters:
        id - the Atlassian Account ID or collection name
        Returns:
        the new mention node
      • id

        public String id()
        Returns the ID of the mention's target.
        Returns:
        the ID of the mention's target.
      • accessLevel

        public Optional<String> accessLevel()
        Returns the access level for this mention, if set.
        Returns:
        the access level for this mention, or empty() if not set.
      • accessLevel

        public Mention accessLevel​(@Nullable
                                   String accessLevel)
        Sets the access level value for the mention.
        Returns:
        this
      • accessLevel

        public Mention accessLevel​(@Nullable
                                   Mention.AccessLevel accessLevel)
        Sets the access level value for the mention.
        Returns:
        this
      • userType

        public Optional<Mention.UserType> userType()
        Returns the user type for this mention, if set.
        Returns:
        the user type for this mention, or empty() if not set.
      • userType

        public Mention userType​(@Nullable
                                String userType)
        Sets the user type value for the mention.
        Returns:
        this
      • userType

        public Mention userType​(@Nullable
                                Mention.UserType userType)
        Sets the user type value for the mention.
        Returns:
        this
      • text

        public Optional<String> text()
        Returns the display text for this mention, if set.
        Returns:
        the display text for this mention, or empty() if not set.
      • text

        public Mention text​(@Nullable
                            String text)
        Sets the text value for the mention.
        NB: As a temporary change (to replicate the behaviour of the TypeScript transformer) until the OMIT_EMPTY_ATTRIBUTES parser feature flag is enabled: if text is an empty string, it will be treated as text (i.e. "").
        Once the feature flag is enabled, we will return to the original behaviour: if text is an empty string, it will be treated as null.
        If it isn't empty but also does not begin with @, then the value will be prefixed with it automatically.
        Parameters:
        text - the text that is displayed for the mention, which must begin with an @ char.
        Returns:
        this
      • nodeEquals

        protected boolean nodeEquals​(Mention 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<Mention>
        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)
      • nodeHashCode

        protected 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<Mention>
        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)
      • copy

        public Mention 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 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
      • validate

        public 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
      • 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 AbstractNode<Mention>
        Parameters:
        sb - where to write the result