Package org.apache.sis.referencing
Class ImmutableIdentifier
Object
FormattableObject
ImmutableIdentifier
- All Implemented Interfaces:
- Serializable,- Identifier,- ReferenceIdentifier
- Direct Known Subclasses:
- NamedIdentifier
@TitleProperty(name="code")
public class ImmutableIdentifier
extends FormattableObject
implements ReferenceIdentifier, Serializable
Immutable value uniquely identifying an object within a namespace, together with a version.
 This kind of identifier is primarily used for identification of
 
CoordinateReferenceSystem objects.
 Immutability and thread safety
This class is immutable and thus inherently thread-safe if theCitation 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.transitionTo(DefaultCitation.State.FINAL) 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.
 Text, URN and XML representations
Identifiers are represented in various ways depending on the context. In particular identifiers are marshalled differently depending on whether they appear in a metadata object or a referencing object. The following examples show an identifier for a Geographic Coordinate Reference System (CRS) identified by code 4326 in the "EPSG" code space:- 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 aURIelement, 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="IOGP">urn:ogc:def:crs:EPSG::4326</gml:identifier> codeSpaceattribute - 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 of identifier in a metadata is defined byDefaultIdentifier.
- Since:
- 1.0
- See Also:
Defined in the sis-referencing module
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringKey for the "description" property in the map to be given to the constructor.Fields inherited from interface IdentifierAUTHORITY_KEY, CODE_KEYFields inherited from interface ReferenceIdentifierCODESPACE_KEY, VERSION_KEY
- 
Constructor SummaryConstructorsConstructorDescriptionImmutableIdentifier(Map<String, ?> properties) Constructs an identifier from the given properties.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 description) Creates a new identifier from the specified code and authority, with an optional version number and description.ImmutableIdentifier(ReferenceIdentifier identifier) Creates a new identifier from the specified one.
- 
Method SummaryModifier and TypeMethodDescriptionstatic ImmutableIdentifiercastOrCopy(ReferenceIdentifier object) Returns a SIS identifier implementation with the values of the given arbitrary implementation.booleanCompares this object with the given one for equality.protected StringFormats this identifier as a Well Known TextId[…]element.The person or party responsible for maintenance of the namespace.getCode()Alphanumeric value identifying an instance in the namespace.Identifier or namespace in which the code is valid.Natural language description of the meaning of the code value.The version identifier for the namespace, as specified by the code authority.intReturns a hash code value for this object.Methods inherited from class FormattableObjectprint, toString, toString, toWKT
- 
Field Details- 
DESCRIPTION_KEYKey for the "description" property in the map to be given to the constructor. This can be used for setting the value to be returned bygetDescription().- See Also:
 
 
- 
- 
Constructor Details- 
ImmutableIdentifierCreates a new identifier from the specified one. This is a copy constructor which get the code, codespace, authority and version from the given identifier.- Parameters:
- identifier- the identifier to copy.
- See Also:
 
- 
ImmutableIdentifierCreates a new identifier from the specified code and authority.- Parameters:
- authority- the person or party responsible for maintenance of the namespace, or- nullif not available.
- codeSpace- identifier or namespace in which the code is valid, or- nullif not available. This is often an abbreviation of the authority name.
- code- alphanumeric value identifying an instance in the namespace. The code cannot be null.
 
- 
ImmutableIdentifierpublic ImmutableIdentifier(Citation authority, String codeSpace, String code, String version, InternationalString description) Creates a new identifier from the specified code and authority, with an optional version number and description.- Parameters:
- authority- the person or party responsible for maintenance of the namespace, or- nullif not available.
- codeSpace- identifier or namespace in which the code is valid, or- nullif not available. This is often an abbreviation of the authority name.
- code- alphanumeric value identifying an instance in the namespace. The code cannot be null.
- version- the version identifier for the namespace as specified by the code authority, or- nullif none.
- description- natural language description of the meaning of the code value, or- nullif none.
 
- 
ImmutableIdentifierConstructs an identifier from the given properties. Keys are strings from the table below. The map given in argument shall contain an entry at least for the "code" key. Other properties listed in the table below are optional.Recognized properties Property name Value type Returned by "code" StringgetCode()"codespace" StringgetCodeSpace()"authority" StringorCitationgetAuthority()"version" StringgetVersion()"description" StringorInternationalStringgetDescription()"locale" Locale(none) Localization"description"is a localizable attributes which may have a language and country code suffix. For example, the"description_fr"property stands for description in French and the"description_fr_CA"property stands for description in French Canadian.The "locale"property applies only to exception messages, if any. After successful construction,ImmutableIdentifierinstances do not keep the locale since localizations are deferred to theInternationalString.toString(Locale)method.- Parameters:
- properties- the properties to be given to this identifier.
- Throws:
- IllegalArgumentException- if a property has an illegal value.
 
 
- 
- 
Method Details- 
castOrCopyReturns a SIS identifier implementation with the values of the given arbitrary implementation. This method performs the first applicable action in the following choices:- If the given object is null, then this method returnsnull.
- Otherwise if the given object is already an instance of
       ImmutableIdentifier, then it is returned unchanged.
- Otherwise a new ImmutableIdentifierinstance is created using the copy constructor and returned. Note that this is a shallow copy operation, because the other metadata contained in the given object are not recursively copied.
 - Parameters:
- object- the object to get as a SIS implementation, or- nullif none.
- Returns:
- a SIS implementation containing the values of the given object (may be the
         given object itself), or nullif the argument was null.
 
- If the given object is 
- 
getAuthorityThe person or party responsible for maintenance of the namespace. The organization's abbreviation is often the same than this identifier code space, but not necessarily.- Specified by:
- getAuthorityin interface- Identifier
- Returns:
- the authority, or nullif not available.
 
- 
getCodeAlphanumeric value identifying an instance in the namespace.Example:"4326".- Specified by:
- getCodein interface- Identifier
- Returns:
- value identifying an instance in the namespace (never null).
- See Also:
 
- 
getCodeSpaceIdentifier or namespace in which the code is valid. This is often the authority's abbreviation, but not necessarily.Example:"EPSG".- Specified by:
- getCodeSpacein interface- ReferenceIdentifier
- Returns:
- identifier or namespace in which the code is valid, or nullif not available.
- See Also:
 
- 
getVersionThe version identifier for the namespace, as specified by the code authority. This version is included only when the code uses versions. When appropriate, the edition is identified by the effective date, coded using ISO 8601 date format.Example: the version of the underlying EPSG database.- Specified by:
- getVersionin interface- ReferenceIdentifier
- Returns:
- the version identifier for the namespace, or nullif none.
 
- 
getDescriptionNatural language description of the meaning of the code value.Example: "World Geodetic System 1984".- Returns:
- the natural language description, or nullif none.
- Since:
- 0.5
 
- 
hashCodepublic int hashCode()Returns a hash code value for this object.
- 
equalsCompares this object with the given one for equality.
- 
formatToFormats this identifier as a Well Known TextId[…]element. See class javadoc for more information on the WKT format.- Specified by:
- formatToin class- FormattableObject
- Parameters:
- formatter- the formatter where to format the inner content of this WKT element.
- Returns:
- "Id"(WKT 2) or- "Authority"(WKT 1).
- See Also:
 
 
-