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 aNonMarshalledAuthority
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
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.boolean
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.getCode()
Returns a string representation of the identifier value, ornull
if none.Infers a code space from the authority.getValue()
Returns the identifier value.Returnsnull
since this class does not hold version information.int
hashCode()
Returns a hash code value for this identifier.(package private) static org.opengis.referencing.ReferenceIdentifier
Creates an identifier from a text value.(package private) static void
parseFailure
(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 aNonMarshalledAuthority
instance. Null value is not recommended, but thisSpecializedIdentifier
is 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, ornull
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 ofSpecializedIdentifier
if the given authority is one of the "special" authorities declared in theIdentifierSpace
interface. Otherwise a plainIdentifierMapEntry
is created.- Parameters:
authority
- the authority, typically as one of theIdentifierSpace
constants.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 genericIdentifierMapEntry
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, ornull
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 interfaceorg.opengis.metadata.Identifier
- Returns:
- the identifier authority.
-
getValue
- Returns:
- the identifier value, or
null
if none.
-
getCode
Returns a string representation of the identifier value, ornull
if none.- Specified by:
getCode
in interfaceorg.opengis.metadata.Identifier
- Returns:
- the identifier value.
-
getCodeSpace
Infers a code space from the authority.- Specified by:
getCodeSpace
in interfaceorg.opengis.referencing.ReferenceIdentifier
- Returns:
- the code space, or
null
if none. - Since:
- 0.5
-
getVersion
Returnsnull
since this class does not hold version information.- Specified by:
getVersion
in 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.
-