An identification of a CRS object which is both a {@link ReferenceIdentifier} and a {@link GenericName}. This class implements both interfaces in order to allow usage of the same instance either as an object {@linkplain AbstractIdentifiedObject#getName() name} or {@linkplain AbstractIdentifiedObject#getAlias() alias}. This flexibility make easier to uses object's names in two different models:
- In the ISO 19111 model, objects have a single name of type {@code RS_Identifier} and an arbitrary amountof aliases of type {@code GenericName}.
- In the GML model, objects have an arbitrary amount of names of type {@code gml:CodeType}, but do not have any alias.
By using this {@code NamedIdentifier} class, users can declare supplemental object's names as{@linkplain AbstractIdentifiedObject#getAlias() aliases} and have those names used in contextswhere {@code ReferenceIdentifier} instances are required, like GML marshalling time.{@section Name ↔ Identifier mapping}The {@code GenericName} attributes will be inferred from {@code ReferenceIdentifier} attributes as below:
- {@linkplain #tip() Tip}: derived from the identifier {@linkplain #getCode() code}.
- {@linkplain #head() Head}: derived from the identifier {@linkplain #getCodeSpace() code space}.
- {@linkplain #scope() Scope}: derived from the shortest {@linkplain #getAuthority() authority}'s {@linkplain Citation#getAlternateTitles() alternate titles}, or the {@linkplain Citation#getTitle() main title}if there is no alternate titles. This policy exploits the ISO 19115 comment saying that citation alternate titles often contain abbreviation (for example "DCW" as an alternative title for "Digital Chart of the World").
Example: If the identifier attributes are {@code authority} = {@link Citations#OGP}, {@code codeSpace} = {@code "EPSG"}and {@code code} = {@code "4326"}, then the name attributes will be {@code scope} = {@code "OGP"}, {@code head} = {@code "EPSG"}, {@code tip} = {@code "4326"} and {@link #toString()} = {@code "EPSG:4326"}. Note that the scope does not appear in the string representation of names.
{@section Immutability and thread safety}This class is immutable and thus inherently thread-safe if the {@link Citation} and {@link InternationalString}arguments given to the constructor are also immutable. It is caller's responsibility to ensure that those conditions hold, for example by invoking {@link org.apache.sis.metadata.iso.citation.DefaultCitation#freeze() 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 {@code NamedIdentifier} state.
@author Martin Desruisseaux (IRD, Geomatys)
@since 0.4 (derived from geotk-2.0)
@version 0.4
@module