java.lang.Object
org.apache.sis.internal.storage.gpx.Link
All Implemented Interfaces:
org.opengis.metadata.citation.OnlineResource

public final class Link extends Object implements org.opengis.metadata.citation.OnlineResource
A link to an external resource (Web page, digital photo, video clip, etc) with additional information. This element provides 3 properties:
  • The uri, which is the only mandatory property.
  • The text to show for the link.
  • The MIME type.
Those properties can be read or modified directly. All methods defined in this class are bridges to the ISO 19115 metadata model and can be ignored if the user only wants to manipulate the GPX model.
Since:
0.8
Version:
0.8
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Text of hyper-link.
    MIME type of content (for example "image/jpeg").
    URL of hyper-link.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Creates an initially empty instance.
     
    Link(URI uri)
    Creates a new instance initialized to the given URI.
    private
    Link(org.opengis.metadata.citation.OnlineResource r, Locale locale)
    Copies properties from the given ISO 19115 metadata.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) final void
    Invoked by JAXB after unmarshalling.
    static Link
    castOrCopy(org.opengis.metadata.citation.OnlineResource r, Locale locale)
    Returns the given ISO 19115 metadata as a Link instance.
    boolean
    Compares this Link with the given object for equality.
    ISO 19115 metadata property not specified by GPX.
    org.opengis.util.InternationalString
    ISO 19115 metadata property not specified by GPX.
    org.opengis.metadata.citation.OnLineFunction
    ISO 19115 metadata property not specified by GPX.
    ISO 19115 metadata property determined by the uri field.
    ISO 19115 metadata property determined by the text field.
    ISO 19115 metadata property not specified by GPX.
    int
    Returns a hash code value for this Link.
    Returns the string representation of uri, or null if uri is null.
    (package private) static Link
    valueOf(URI uri)
    Creates a new instance initialized to the given URI.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • uri

      public URI uri
      URL of hyper-link.
      See Also:
    • text

      public String text
      Text of hyper-link.
      See Also:
    • type

      public String type
      MIME type of content (for example "image/jpeg").
  • Constructor Details

    • Link

      public Link()
      Creates an initially empty instance. Callers should set at least the uri field after construction.
    • Link

      public Link(URI uri)
      Creates a new instance initialized to the given URI.
      Parameters:
      uri - the URI.
    • Link

      private Link(org.opengis.metadata.citation.OnlineResource r, Locale locale)
      Copies properties from the given ISO 19115 metadata.
  • Method Details

    • valueOf

      static Link valueOf(URI uri)
      Creates a new instance initialized to the given URI.
      Parameters:
      uri - the URI, or null.
      Returns:
      the link, or null if the given URI was null.
    • afterUnmarshal

      final void afterUnmarshal(Unmarshaller um, Object parent)
      Invoked by JAXB after unmarshalling. If the uri is not set but the text looks like a URI, uses that text. The intent is to handle link that should have been defined like below: but instead has erroneously been defined like below: If we fail to convert the text to a URI, we will leave the object state as-is.
    • castOrCopy

      public static Link castOrCopy(org.opengis.metadata.citation.OnlineResource r, Locale locale)
      Returns the given ISO 19115 metadata as a Link instance. This method copies the data only if needed.
      Parameters:
      r - the ISO 19115 metadata, or null.
      locale - the locale to use for localized strings.
      Returns:
      the GPX metadata, or null.
    • getLinkage

      public URI getLinkage()
      ISO 19115 metadata property determined by the uri field.
      Specified by:
      getLinkage in interface org.opengis.metadata.citation.OnlineResource
      Returns:
      location for on-line access using a URL address or similar scheme.
    • getProtocol

      public String getProtocol()
      ISO 19115 metadata property not specified by GPX.
      Specified by:
      getProtocol in interface org.opengis.metadata.citation.OnlineResource
      Returns:
      connection protocol to be used.
    • getApplicationProfile

      public String getApplicationProfile()
      ISO 19115 metadata property not specified by GPX.
      Specified by:
      getApplicationProfile in interface org.opengis.metadata.citation.OnlineResource
      Returns:
      application profile that can be used with the online resource.
    • getName

      public String getName()
      ISO 19115 metadata property determined by the text field.
      Specified by:
      getName in interface org.opengis.metadata.citation.OnlineResource
      Returns:
      name of the online resource.
    • getDescription

      public org.opengis.util.InternationalString getDescription()
      ISO 19115 metadata property not specified by GPX.
      Specified by:
      getDescription in interface org.opengis.metadata.citation.OnlineResource
      Returns:
      text description of what the online resource is/does.
    • getFunction

      public org.opengis.metadata.citation.OnLineFunction getFunction()
      ISO 19115 metadata property not specified by GPX.
      Specified by:
      getFunction in interface org.opengis.metadata.citation.OnlineResource
      Returns:
      function performed by the online resource.
    • equals

      public boolean equals(Object obj)
      Compares this Link with the given object for equality.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare with this Link.
      Returns:
      true if both objects are equal.
    • hashCode

      public int hashCode()
      Returns a hash code value for this Link.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value.
    • toString

      public String toString()
      Returns the string representation of uri, or null if uri is null. This method is intended to allow direct usage of Link in code that format arbitrary Object.
      Overrides:
      toString in class Object
      Returns:
      the URI, or null.