Package org.geotools.referencing
Class NamedIdentifier
- Object
-
- NamedIdentifier
-
- All Implemented Interfaces:
Serializable,Comparable<GenericName>,Identifier,ReferenceIdentifier,GenericName
public class NamedIdentifier extends Object implements ReferenceIdentifier, GenericName, Comparable<GenericName>, Serializable
An identification of a CRS object. The main interface implemented by this class isReferenceIdentifier. However, this class also implementsGenericNamein order to make it possible to reuse the same identifiers in the list of aliases. Casting an alias's generic name to an identifier gives access to more informations, like the URL of the authority.The generic name will be infered from identifier attributes. More specifically, a scoped name will be constructed using the shortest authority's alternate titles (or the main title if there is no alternate titles) as the scope, and the code as the head. This heuristic rule seems raisonable since, according ISO 19115, the alternate titles often contains abreviation (for example "DCW" as an alternative title for "Digital Chart of the World").
- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface Identifier
AUTHORITY_KEY, CODE_KEY
-
Fields inherited from interface ReferenceIdentifier
CODESPACE_KEY, VERSION_KEY
-
-
Constructor Summary
Constructors Constructor Description NamedIdentifier(Map<String,?> properties)Constructs an identifier from a set of properties.NamedIdentifier(Citation authority, String code)Constructs an identifier from an authority and code informations.NamedIdentifier(Citation authority, String code, String version)Constructs an identifier from an authority and code informations.NamedIdentifier(Citation authority, InternationalString code)Constructs an identifier from an authority and code informations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(GenericName object)Compares this name with the specified object for order.intdepth()Returns the depth of this name within the namespace hierarchy.booleanequals(Object object)Compares this identifier with the specified object for equality.CitationgetAuthority()Organization or party responsible for definition and maintenance of the code.StringgetCode()Identifier code or name, optionally from a controlled list or pattern.StringgetCodeSpace()Name or identifier of the person or organization responsible for namespace.List<LocalName>getParsedNames()Returns the sequence of local names making this generic name.InternationalStringgetRemarks()Comments on or information about this identifier, ornullif none.StringgetVersion()Identifier of the version of the associated code space or code, as specified by the code authority.inthashCode()Returns a hash code value for this identifier.LocalNamehead()Returns the first element in the sequence of parsed names.ScopedNamepush(GenericName scope)Returns this name expanded with the specified scope.NameSpacescope()Returns the scope (name space) in which this name is local.LocalNametip()Returns the last element in the sequence of parsed names.GenericNametoFullyQualifiedName()Returns a view of this name as a fully-qualified name.InternationalStringtoInternationalString()Returns a local-dependent string representation of this generic name.StringtoString()Returns a string representation of this generic name.
-
-
-
Constructor Detail
-
NamedIdentifier
public NamedIdentifier(Map<String,?> properties) throws IllegalArgumentException
Constructs an identifier from a set of properties. Keys are strings from the table below. Key are case-insensitive, and leading and trailing spaces are ignored. The map given in argument shall contains at least a"code"property. Other properties listed in the table below are optional.Property name Value type Value given to "code"StringgetCode()"code"StringgetCodeSpace()"authority"StringorCitationgetAuthority()"version"StringgetVersion()"remarks"StringorInternationalStringgetRemarks()"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.- Parameters:
properties- The properties to be given to this identifier.- Throws:
InvalidParameterValueException- if a property has an invalid value.IllegalArgumentException- if a property is invalid for some other reason.
-
NamedIdentifier
public NamedIdentifier(Citation authority, InternationalString code)
Constructs an identifier from an authority and code informations. This is a convenience constructor for commonly-used parameters. If more control are wanted (for example adding remarks), use the constructor with a properties map.- Parameters:
authority- The authority (e.g.OGCorEPSG).code- The code. The English name is used for the code, and the international string is used for the generic name.
-
NamedIdentifier
public NamedIdentifier(Citation authority, String code)
Constructs an identifier from an authority and code informations. This is a convenience constructor for commonly-used parameters. If more control are wanted (for example adding remarks), use the constructor with a properties map.
-
NamedIdentifier
public NamedIdentifier(Citation authority, String code, String version)
Constructs an identifier from an authority and code informations. This is a convenience constructor for commonly-used parameters. If more control are wanted (for example adding remarks), use the constructor with a properties map.
-
-
Method Detail
-
getCode
public String getCode()
Identifier code or name, optionally from a controlled list or pattern.- Specified by:
getCodein interfaceIdentifier- Returns:
- The code.
-
getCodeSpace
public String getCodeSpace()
Name or identifier of the person or organization responsible for namespace.- Specified by:
getCodeSpacein interfaceReferenceIdentifier- Returns:
- The codespace, or
nullif not available.
-
getAuthority
public Citation getAuthority()
Organization or party responsible for definition and maintenance of the code.- Specified by:
getAuthorityin interfaceIdentifier- Returns:
- The authority, or
nullif not available.
-
getVersion
public String getVersion()
Identifier of the version of the associated code space or code, 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.- Specified by:
getVersionin interfaceReferenceIdentifier- Returns:
- The version, or
nullif not available.
-
getRemarks
public InternationalString getRemarks()
Comments on or information about this identifier, ornullif none.- Returns:
- Optional comments about this identifier.
-
head
public LocalName head()
Returns the first element in the sequence of parsed names.- Specified by:
headin interfaceGenericName- Returns:
- The first element in the list of parsed names.
- Since:
- 2.6
-
tip
public LocalName tip()
Returns the last element in the sequence of parsed names.- Specified by:
tipin interfaceGenericName- Returns:
- The last element in the list of parsed names.
- Since:
- 2.3
-
scope
public NameSpace scope()
Returns the scope (name space) in which this name is local.- Specified by:
scopein interfaceGenericName- Returns:
- The scope of this name.
- Since:
- 2.3
-
depth
public int depth()
Returns the depth of this name within the namespace hierarchy.- Specified by:
depthin interfaceGenericName- Returns:
- The depth of this name.
- Since:
- 2.3
-
getParsedNames
public List<LocalName> getParsedNames()
Returns the sequence of local names making this generic name. Each element in this list is like a directory name in a file path name. The length of this sequence is the generic name depth.- Specified by:
getParsedNamesin interfaceGenericName- Returns:
- The local names making this generic name, without the scope. Shall never be
nullneither empty.
-
push
public ScopedName push(GenericName scope)
Returns this name expanded with the specified scope. One may represent this operation as a concatenation of the specifiednamewiththis.- Specified by:
pushin interfaceGenericName- Parameters:
scope- The name to use as prefix.- Returns:
- A concatenation of the given name with this name.
- Since:
- 2.3
-
toFullyQualifiedName
public GenericName toFullyQualifiedName()
Returns a view of this name as a fully-qualified name.- Specified by:
toFullyQualifiedNamein interfaceGenericName- Returns:
- The fully-qualified name (never
null). - Since:
- 2.3
-
toInternationalString
public InternationalString toInternationalString()
Returns a local-dependent string representation of this generic name. This string is similar to the one returned bytoString()except that each element has been localized in the specified locale. If no international string is available, then this method returns an implementation mapping totoString()for all locales.- Specified by:
toInternationalStringin interfaceGenericName- Returns:
- A localizable string representation of this name.
-
toString
public String toString()
Returns a string representation of this generic name. This string representation is local-independant. It contains all elements listed bygetParsedNames()separated by an arbitrary character (usually:or/).- Specified by:
toStringin interfaceGenericName- Overrides:
toStringin classObject- Returns:
- A local-independant string representation of this name.
-
compareTo
public int compareTo(GenericName object)
Compares this name with the specified object for order. Returns a negative integer, zero, or a positive integer as this name lexicographically precedes, is equals to, or follows the specified object.- Specified by:
compareToin interfaceComparable<GenericName>- Parameters:
object- The object to compare with.- Returns:
- -1 if this identifier precedes the given object, +1 if it follows it.
-
equals
public boolean equals(Object object)
Compares this identifier with the specified object for equality.
-
-