Class Link

    • Method Detail

      • a

        public static Link a​(String href)
        Parameters:
        href - the URI for the hyperlink, equivalent to the href value for an HTML <a> element
        Returns:
        a link mark
        Throws:
        AdfException.InvalidURI - if href cannot be parsed as a valid URI
      • a

        public static Link a​(URL href)
        Parameters:
        href - the URI for the hyperlink, equivalent to the href value for an HTML <a> element
        Returns:
        a link mark
        Throws:
        AdfException.InvalidURI - if href cannot be parsed as a valid URI
      • a

        public static Link a​(URI href)
        Parameters:
        href - the URI for the hyperlink, equivalent to the href value for an HTML <a> element
        Returns:
        a link mark
      • link

        public static Link link​(String href)
        Parameters:
        href - the URI for the hyperlink, equivalent to the href value for an HTML <a> element
        Returns:
        a link mark
        Throws:
        AdfException.InvalidURI - if href cannot be parsed as a valid URI
      • link

        public static Link link​(URL href)
        Parameters:
        href - the URI for the hyperlink, equivalent to the href value for an HTML <a> element
        Returns:
        a link mark
        Throws:
        AdfException.InvalidURI - if href cannot be parsed as a valid URI
      • link

        public static Link link​(URI href)
        Parameters:
        href - the URI for the hyperlink, equivalent to the href value for an HTML <a> element
        Returns:
        a link mark
      • copy

        public Link 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 CodeTextMark
        Specified by:
        copy in interface Element
        Specified by:
        copy in interface FormattedTextMark
        Specified by:
        copy in interface Mark
        Specified by:
        copy in interface MediaInlineMark
        Specified by:
        copy in interface MediaMark
        Specified by:
        copy in interface MediaSingleMark
        Specified by:
        copy in interface TextMark
        Returns:
        a copy of this element, or this if the element is immutable anyway
      • title

        public Optional<String> title()
        Returns the title value for this link, if set.
        Returns:
        the title value for this link, or empty() if not set.
      • href

        public String href()
        Returns the href value for the link; that is, its target URI.
      • href

        public Link href​(String href)
        Modifies this link's target.
        Parameters:
        href - the new target URI for this link
        Returns:
        this
        Throws:
        AdfException.InvalidURI - if href cannot be parsed as a valid URI
      • href

        public Link href​(URL href)
        Modifies this link's target.
        Parameters:
        href - the new target URI for this link
        Returns:
        this
        Throws:
        AdfException.InvalidURI - if href cannot be parsed as a valid URI
      • href

        public Link href​(URI href)
        Modifies this link's target.
        Parameters:
        href - the new target URI for this link
        Returns:
        this
      • title

        public Link title​(@Nullable
                          String title)
        Parameters:
        title - the title text for the hyperlink, equivalent to the title value for an HTML <a> element
        Returns:
        this
      • collection

        public Link collection​(@Nullable
                               String collection)
      • occurrenceKey

        public Link occurrenceKey​(String occurrenceKey)
      • 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
      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toString

        public String toString()
      • mapWithType

        protected FieldMap mapWithType()
      • isSupported

        public boolean isSupported()
        Description copied from interface: Element
        Indicates whether this element is fully supported by this library. This library includes a small amount of support for preserving new, unrecognized node types during a round trip. These are represented by immutable placeholder objects that return false for this value.
        Specified by:
        isSupported in interface Element
        Returns:
        true for fully supported elements; false for immutable placeholders
      • 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