public class ImmutableIdentifier extends FormattableObject implements ReferenceIdentifier, Deprecable, Serializable
CoordinateReferenceSystem
objects.
Citation
and InternationalString
arguments given to the constructor are also immutable. It is caller's responsibility to ensure that those
conditions hold, for example by invoking DefaultCitation.freeze()
before passing the arguments to the constructor.
Subclasses shall make sure that any overridden methods remain safe to call from multiple threads and do not change
any public ImmutableIdentifier
state.
Well Known Text (WKT) version 1
The WKT 1 format contains only the code space and the code. If there is no code space, then the authority abbreviation is used as a fallback. Example:AUTHORITY["EPSG", "4326"]
Well Known Text (WKT) version 2
The WKT 2 format contains the code space, the code, the version and the authority citation if available. The WKT can optionally provides aURI
element, which expresses the same information in a different way
(the URN syntax is described in the next item below).
Example:
ID["EPSG", 4326, URI["urn:ogc:def:crs:EPSG::4326"]]
XML in referencing objects
The Definition identifier URNs in OGC namespace paper defines a syntax for identifiers commonly found in Geographic Markup Language (GML) documents. Example:In Apache SIS, the GML<gml:identifier codeSpace="OGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
codeSpace
attribute - despite its name - is mapped to the identifier
authority. The components of the URN value are mapped as below:
urn:ogc:def:<type>:<codespace>:<version>:<code>
XML in metadata objects
The XML representation ofImmutableIdentifier
in a metadata is similar to the DefaultIdentifier
one except for the "RS_"
prefix:
<gmd:RS_Identifier> <gmd:code> <gco:CharacterString>4326</gco:CharacterString> </gmd:code> <gmd:authority> <gmd:CI_Citation> <gmd:title> <gco:CharacterString>EPSG</gco:CharacterString> </gmd:title> </gmd:CI_Citation> </gmd:authority> </gmd:RS_Identifier>
DefaultIdentifier
,
Serialized FormDefined in the sis-metadata
module
Modifier and Type | Field and Description |
---|---|
static String |
DESCRIPTION_KEY
Key for the "description" property in the map to be given to the constructor.
|
CODESPACE_KEY, VERSION_KEY
AUTHORITY_KEY, CODE_KEY
Constructor and Description |
---|
ImmutableIdentifier(Citation authority,
String codeSpace,
String code)
Creates a new identifier from the specified code and authority.
|
ImmutableIdentifier(Citation authority,
String codeSpace,
String code,
String version,
InternationalString remarks)
Creates a new identifier from the specified code and authority,
with an optional version number and remarks.
|
ImmutableIdentifier(Map<String,?> properties)
Constructs an identifier from the given properties.
|
ImmutableIdentifier(ReferenceIdentifier identifier)
Creates a new identifier from the specified one.
|
Modifier and Type | Method and Description |
---|---|
static ImmutableIdentifier |
castOrCopy(ReferenceIdentifier object)
Returns a SIS identifier implementation with the values of the given arbitrary implementation.
|
boolean |
equals(Object object)
Compares this object with the given one for equality.
|
protected String |
formatTo(Formatter formatter)
Formats this identifier as a Well Known Text
Id[…] element. |
Citation |
getAuthority()
Organization or party responsible for definition and maintenance of the
code.
|
String |
getCode()
Identifier code or name, optionally from a controlled list or pattern.
|
String |
getCodeSpace()
Name or identifier of the person or organization responsible for namespace.
|
InternationalString |
getDescription()
Natural language description of the meaning of the code value.
|
InternationalString |
getRemarks()
Comments on or information about this identifier, or
null if none. |
String |
getVersion()
Identifier of the version of the associated code space or code, as specified by the
code authority.
|
int |
hashCode()
Returns a hash code value for this object.
|
boolean |
isDeprecated()
Returns
true if the object represented by this identifier is deprecated. |
print, toString, toString, toWKT
public static final String DESCRIPTION_KEY
getDescription()
.public ImmutableIdentifier(ReferenceIdentifier identifier)
identifier
- The identifier to copy.public ImmutableIdentifier(Citation authority, String codeSpace, String code)
authority
- Organization or party responsible for definition and maintenance of the code
space or code, or null
if not available.codeSpace
- Name or identifier of the person or organization responsible for namespace, or
null
if not available. This is often an abbreviation of the authority name.code
- Identifier code or name, optionally from a controlled list or pattern defined by
a code space. The code can not be null.public ImmutableIdentifier(Citation authority, String codeSpace, String code, String version, InternationalString remarks)
authority
- Organization or party responsible for definition and maintenance of the code
space or code, or null
if not available.codeSpace
- Name or identifier of the person or organization responsible for namespace, or
null
if not available. This is often an abbreviation of the authority name.code
- Identifier code or name, optionally from a controlled list or pattern defined by
a code space. The code can not be null.version
- The version of the associated code space or code as specified by the code authority,
or null
if none.remarks
- Comments on or information about this identifier, or null
if none.public ImmutableIdentifier(Map<String,?> properties) throws IllegalArgumentException
Property name | Value type | Returned by |
---|---|---|
"code" | String |
getCode() |
"codespace" | String |
getCodeSpace() |
"authority" | String or Citation |
getAuthority() |
"version" | String |
getVersion() |
"description" | String or InternationalString |
getDescription() |
"remarks" | String or InternationalString |
getRemarks() |
"locale" | Locale |
(none) |
"remarks"
is a localizable attributes which may have a language and country
code suffix. For example the "remarks_fr"
property stands for remarks in
French and the "remarks_fr_CA"
property stands
for remarks in French Canadian.
The "locale"
property applies only to exception messages, if any.
After successful construction, ImmutableIdentifier
instances do not keep the locale
since localizations are deferred to the InternationalString.toString(Locale)
method.
properties
- The properties to be given to this identifier.InvalidParameterValueException
- if a property has an invalid value.IllegalArgumentException
- if a property is invalid for some other reason.public static ImmutableIdentifier castOrCopy(ReferenceIdentifier object)
null
, then this method returns null
.ImmutableIdentifier
, then it is returned unchanged.ImmutableIdentifier
instance is created using the
copy constructor and returned.
Note that this is a shallow copy operation, since the other
metadata contained in the given object are not recursively copied.object
- The object to get as a SIS implementation, or null
if none.null
if the argument was null.public String getCode()
"4326"
.getCode
in interface Identifier
null
.NamedIdentifier.tip()
public String getCodeSpace()
"EPSG"
.getCodeSpace
in interface ReferenceIdentifier
null
if not available.NamedIdentifier.head()
,
NamedIdentifier.scope()
public Citation getAuthority()
Citations.OGP
, since OGP is the organization maintaining the EPSG geodetic database.getAuthority
in interface Identifier
null
if not available.public String getVersion()
getVersion
in interface ReferenceIdentifier
null
if not available.public InternationalString getDescription()
null
if none.public InternationalString getRemarks()
null
if none.
getRemarks
in interface Deprecable
null
if none.public boolean isDeprecated()
true
if the object represented by this identifier is deprecated. In such
case, the remarks may contains the new identifier to use.
The default implementation returns false
in all cases.
isDeprecated
in interface Deprecable
true
if this code is deprecated.AbstractIdentifiedObject.isDeprecated()
public int hashCode()
public boolean equals(Object object)
protected String formatTo(Formatter formatter)
Id[…]
element.
See class javadoc for more information on the WKT format.formatTo
in class FormattableObject
formatter
- The formatter where to format the inner content of this WKT element."Id"
(WKT 2) or "Authority"
(WKT 1).FormattableObject.toWKT()
,
FormattableObject.toString()
Copyright © 2010–2015 The Apache Software Foundation. All rights reserved.