Class SpecializedIdentifier<T>

java.lang.Object
org.apache.sis.internal.jaxb.SpecializedIdentifier<T>
Type Parameters:
T - the value type, typically XLink, UUID or String.
All Implemented Interfaces:
Serializable, Cloneable, org.opengis.metadata.Identifier, org.opengis.referencing.ReferenceIdentifier

public final class SpecializedIdentifier<T> extends Object implements org.opengis.referencing.ReferenceIdentifier, Cloneable, Serializable
Wraps a XLink, URI or UUID as an identifier in the IdentifierMap. The authority is typically an instance of NonMarshalledAuthority. The value is an object of a type constrained by the authority.
Since:
0.3
Version:
0.7
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final IdentifierSpace<T>
    The authority, typically as a NonMarshalledAuthority instance.
    private static final long
    For cross-version compatibility.
    (package private) T
    The identifier value.

    Fields inherited from interface org.opengis.metadata.Identifier

    AUTHORITY_KEY, CODE_KEY

    Fields inherited from interface org.opengis.referencing.ReferenceIdentifier

    CODESPACE_KEY, VERSION_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new adapter for the given authority and identifier value.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a clone of this identifier.
    boolean
    equals(Object other)
    Compares this identifier with the given object for equality.
    (package private) static void
    format(StringBuilder buffer, org.opengis.metadata.citation.Citation authority, String code)
    Formats the given (authority, code) par value in the given buffer.
    org.opengis.metadata.citation.Citation
    Returns the authority specified at construction time.
    Returns a string representation of the identifier value, or null if none.
    Infers a code space from the authority.
    Returns the identifier value.
    Returns null since this class does not hold version information.
    int
    Returns a hash code value for this identifier.
    (package private) static org.opengis.referencing.ReferenceIdentifier
    parse(org.opengis.metadata.citation.Citation authority, String code)
    Creates an identifier from a text value.
    (package private) static void
    parseFailure(Context context, String value, Class<?> type, Exception cause)
    Invoked by parse(Citation,String) when a string cannot be parsed.
    Returns a string representation of this identifier.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • SpecializedIdentifier

      public SpecializedIdentifier(IdentifierSpace<T> authority, T value)
      Creates a new adapter for the given authority and identifier value.
      Parameters:
      authority - the identifier authority.
      value - the identifier value, or null if not yet defined.
  • Method Details

    • parse

      static org.opengis.referencing.ReferenceIdentifier parse(org.opengis.metadata.citation.Citation authority, String code)
      Creates an identifier from a text value. This method creates an instance of SpecializedIdentifier if the given authority is one of the "special" authorities declared in the IdentifierSpace interface. Otherwise a plain IdentifierMapEntry is created.
      Parameters:
      authority - the authority, typically as one of the IdentifierSpace constants.
      code - the identifier code to parse.
      See Also:
    • parseFailure

      static void parseFailure(Context context, String value, Class<?> type, Exception cause)
      Invoked by parse(Citation,String) when a string cannot be parsed. This is considered a non-fatal error, because the parse method can fallback on the generic IdentifierMapEntry in such cases.

      This method assumes that Map.put(Object, Object) is the public API by which this method has been invoked.

      Parameters:
      context - the marshalling context, or null if none.
      value - the value that we failed to parse.
      type - the target type of the parsing process.
      cause - the exception that occurred during the parsing process.
    • getAuthority

      public org.opengis.metadata.citation.Citation getAuthority()
      Returns the authority specified at construction time.
      Specified by:
      getAuthority in interface org.opengis.metadata.Identifier
      Returns:
      the identifier authority.
    • getValue

      public T getValue()
      Returns the identifier value. This is the code expressed as an object more specialized than String.
      Returns:
      the identifier value, or null if none.
    • getCode

      public String getCode()
      Returns a string representation of the identifier value, or null if none.
      Specified by:
      getCode in interface org.opengis.metadata.Identifier
      Returns:
      the identifier value.
    • getCodeSpace

      public String getCodeSpace()
      Infers a code space from the authority.
      Specified by:
      getCodeSpace in interface org.opengis.referencing.ReferenceIdentifier
      Returns:
      the code space, or null if none.
      Since:
      0.5
    • getVersion

      public String getVersion()
      Returns null since this class does not hold version information.
      Specified by:
      getVersion in interface org.opengis.referencing.ReferenceIdentifier
      Returns:
      null.
      Since:
      0.5
    • hashCode

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

      public boolean equals(Object other)
      Compares this identifier with the given object for equality.
      Overrides:
      equals in class Object
      Parameters:
      other - the object to compare with this identifier for equality.
    • clone

      public Object clone()
      Returns a clone of this identifier.
      Overrides:
      clone in class Object
      Returns:
      a shallow clone of this identifier.
    • toString

      public String toString()
      Returns a string representation of this identifier. Example: Identifier[gco:uuid=“42924124-032a-4dfe-b06e-113e3cb81cf0”].
      Overrides:
      toString in class Object
      See Also:
    • format

      static void format(StringBuilder buffer, org.opengis.metadata.citation.Citation authority, String code)
      Formats the given (authority, code) par value in the given buffer.