Package org.apache.sis.internal.jaxb
Class SpecializedIdentifier<T>
java.lang.Object
org.apache.sis.internal.jaxb.SpecializedIdentifier<T>
- 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
FieldsModifier and TypeFieldDescriptionprivate final IdentifierSpace<T>The authority, typically as aNonMarshalledAuthorityinstance.private static final longFor cross-version compatibility.(package private) TThe identifier value.Fields inherited from interface org.opengis.metadata.Identifier
AUTHORITY_KEY, CODE_KEYFields inherited from interface org.opengis.referencing.ReferenceIdentifier
CODESPACE_KEY, VERSION_KEY -
Constructor Summary
ConstructorsConstructorDescriptionSpecializedIdentifier(IdentifierSpace<T> authority, T value) Creates a new adapter for the given authority and identifier value. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a clone of this identifier.booleanCompares this identifier with the given object for equality.(package private) static voidformat(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.CitationReturns the authority specified at construction time.getCode()Returns a string representation of the identifier value, ornullif none.Infers a code space from the authority.getValue()Returns the identifier value.Returnsnullsince this class does not hold version information.inthashCode()Returns a hash code value for this identifier.(package private) static org.opengis.referencing.ReferenceIdentifierCreates an identifier from a text value.(package private) static voidparseFailure(Context context, String value, Class<?> type, Exception cause) Invoked byparse(Citation,String)when a string cannot be parsed.toString()Returns a string representation of this identifier.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
authority
The authority, typically as aNonMarshalledAuthorityinstance. Null value is not recommended, but thisSpecializedIdentifieris tolerant to such cases.- See Also:
-
value
T valueThe identifier value. The identifier code will be the string representation of this value, if non-null.This value is set at construction time, but may be modified later by
IdentifierMapAdapter.putSpecialized(IdentifierSpace, Object).- See Also:
-
-
Constructor Details
-
SpecializedIdentifier
Creates a new adapter for the given authority and identifier value.- Parameters:
authority- the identifier authority.value- the identifier value, ornullif 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 ofSpecializedIdentifierif the given authority is one of the "special" authorities declared in theIdentifierSpaceinterface. Otherwise a plainIdentifierMapEntryis created.- Parameters:
authority- the authority, typically as one of theIdentifierSpaceconstants.code- the identifier code to parse.- See Also:
-
parseFailure
Invoked byparse(Citation,String)when a string cannot be parsed. This is considered a non-fatal error, because the parse method can fallback on the genericIdentifierMapEntryin 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, ornullif 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:
getAuthorityin interfaceorg.opengis.metadata.Identifier- Returns:
- the identifier authority.
-
getValue
- Returns:
- the identifier value, or
nullif none.
-
getCode
Returns a string representation of the identifier value, ornullif none.- Specified by:
getCodein interfaceorg.opengis.metadata.Identifier- Returns:
- the identifier value.
-
getCodeSpace
Infers a code space from the authority.- Specified by:
getCodeSpacein interfaceorg.opengis.referencing.ReferenceIdentifier- Returns:
- the code space, or
nullif none. - Since:
- 0.5
-
getVersion
Returnsnullsince this class does not hold version information.- Specified by:
getVersionin interfaceorg.opengis.referencing.ReferenceIdentifier- Returns:
null.- Since:
- 0.5
-
hashCode
public int hashCode()Returns a hash code value for this identifier. -
equals
Compares this identifier with the given object for equality. -
clone
Returns a clone of this identifier. -
toString
Returns a string representation of this identifier. Example:Identifier[gco:uuid=“42924124-032a-4dfe-b06e-113e3cb81cf0”]. -
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.
-