Class Anchor

java.lang.Object
org.apache.sis.xml.XLink
org.apache.sis.internal.jaxb.gcx.Anchor
All Implemented Interfaces:
Serializable, CharSequence, Comparable<org.opengis.util.InternationalString>, org.opengis.util.InternationalString

public final class Anchor extends XLink implements org.opengis.util.InternationalString
The Anchor element, which is included in CharacterString elements. In XML documents, anchors are values with XLink attributes used in places where we would normally expect a character sequence. Since Java properties of type CharSequence cannot return XLink, we workaround that restriction by providing this Anchor class as a XLink subtype implementing the InternationalString interface, so it can be used with the above-cited Java properties.
Since:
0.3
Version:
0.8
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Defined as a matter of principle (this class is not expected to be serialized).
      See Also:
    • value

      private String value
      Often a short textual description of the URI target. This is the value returned by toString().
  • Constructor Details

    • Anchor

      public Anchor()
      Creates a uninitialized Anchor. This constructor is required by JAXB.
    • Anchor

      public Anchor(XLink xlink, String value)
      Creates an Anchor initialized to the given xlink value.
      Parameters:
      xlink - the xlink from which to copy the attributes.
      value - often a short textual description of the URI target.
    • Anchor

      public Anchor(URI href, String value)
      Creates an Anchor initialized to the given href value.
      Parameters:
      href - a URI to an external resources or an identifier.
      value - often a short textual description of the URI target.
  • Method Details

    • toString

      public String toString()
      Returns the text as a string, or null if none. The null value is needed for proper working of GO_CharacterString.toString() method.
      Specified by:
      toString in interface CharSequence
      Specified by:
      toString in interface org.opengis.util.InternationalString
      Overrides:
      toString in class XLink
    • toString

      public String toString(Locale locale)
      Returns the text as a string, or null if none.
      Specified by:
      toString in interface org.opengis.util.InternationalString
      Parameters:
      locale - ignored in current implementation.
      Returns:
      the anchor text, or null if none.
    • length

      public int length()
      Returns the number of characters in the value.
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int index)
      Returns the character at the given index.
      Specified by:
      charAt in interface CharSequence
    • subSequence

      public CharSequence subSequence(int start, int end)
      Returns the sequence of characters in the given range of index. The returned object is an anchor with the same attribute values. It is caller responsibility to determine if those attributes are still appropriate for the sub-sequence.
      Specified by:
      subSequence in interface CharSequence
    • compareTo

      public int compareTo(org.opengis.util.InternationalString other)
      Compares the value of this object with the given international string for order. Null values are sorted last.
      Specified by:
      compareTo in interface Comparable<org.opengis.util.InternationalString>
      Parameters:
      other - the string to compare with this anchor type.
    • equals

      public boolean equals(Object object)
      Compares this Anchor with the given object for equality.
      Overrides:
      equals in class XLink
      Parameters:
      object - the object to compare with this anchor type.
    • hashCode

      public int hashCode()
      Returns a hash code value for this anchor type.
      Overrides:
      hashCode in class XLink