Class Link

java.lang.Object
io.jenetics.jpx.Link
All Implemented Interfaces:
Serializable

public final class Link extends Object implements Serializable
Represents a link to an external resource (Web page, digital photo, video clip, etc) with additional information.
Since:
1.0
Version:
1.2
See Also:
  • Method Details

    • getHref

      public URI getHref()
      Return the hyperlink.
      Returns:
      the hyperlink
    • getText

      public Optional<String> getText()
      Return the hyperlink text.
      Returns:
      the hyperlink text
    • getType

      public Optional<String> getType()
      Return the mime type of the hyperlink
      Returns:
      the mime type
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • of

      public static Link of(URI href, String text, String type)
      Create a new Link object with the given parameters.
      Parameters:
      href - the hyperlink (mandatory)
      text - the text of the hyperlink (optional)
      type - the mime type of the content, e.g. image/jpeg (optional)
      Returns:
      a new Link object with the given parameters
      Throws:
      NullPointerException - if the given href is null
    • of

      public static Link of(String href, String text, String type)
      Create a new Link object with the given parameters.
      Parameters:
      href - the hyperlink (mandatory)
      text - the text of the hyperlink (optional)
      type - the mime type of the content, e.g. image/jpeg (optional)
      Returns:
      a new Link object with the given parameters
      Throws:
      NullPointerException - if the given href is null
      IllegalArgumentException - if the given href is not a valid URL
    • of

      public static Link of(URI href)
      Create a new Link object with the given href.
      Parameters:
      href - the hyperlink (mandatory)
      Returns:
      a new Link object with the given href
      Throws:
      NullPointerException - if the given href is null
    • of

      public static Link of(String href)
      Create a new Link object with the given href.
      Parameters:
      href - the hyperlink (mandatory)
      Returns:
      a new Link object with the given href
      Throws:
      NullPointerException - if the given href is null
      IllegalArgumentException - if the given href is not a valid URL