org.geotools.referencing
Class NamedIdentifier

java.lang.Object
  extended byorg.geotools.referencing.NamedIdentifier
All Implemented Interfaces:
java.lang.Comparable, org.opengis.util.GenericName, org.opengis.metadata.Identifier, java.io.Serializable

public class NamedIdentifier
extends java.lang.Object
implements org.opengis.metadata.Identifier, org.opengis.util.GenericName, java.io.Serializable

An identification of a CRS object. The main interface implemented by this class is Identifier. However, this class also implements GenericName in order to make it possible to give 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
Version:
$Id: NamedIdentifier.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.opengis.metadata.Identifier
AUTHORITY_KEY, CODE_KEY, VERSION_KEY
 
Constructor Summary
NamedIdentifier(org.opengis.metadata.citation.Citation authority, org.opengis.util.InternationalString code)
          Constructs an identifier from an authority and code informations.
NamedIdentifier(org.opengis.metadata.citation.Citation authority, java.lang.String code)
          Constructs an identifier from an authority and code informations.
NamedIdentifier(org.opengis.metadata.citation.Citation authority, java.lang.String code, java.lang.String version)
          Constructs an identifier from an authority and code informations.
NamedIdentifier(java.util.Map properties)
          Constructs an identifier from a set of properties.
 
Method Summary
 org.opengis.util.LocalName asLocalName()
          Returns a view of this object as a local name.
 org.opengis.util.ScopedName asScopedName()
          Returns a view of this object as a scoped name, or if this name has no scope.
 int compareTo(java.lang.Object object)
          Compares this name with the specified object for order.
 boolean equals(java.lang.Object object)
          Compares this identifier with the specified object for equality.
 org.opengis.metadata.citation.Citation getAuthority()
          Organization or party responsible for definition and maintenance of the code.
 java.lang.String getCode()
          Identifier code or name, optionally from a controlled list or pattern.
 java.util.List getParsedNames()
          Returns the sequence of local names making this generic name.
 org.opengis.util.InternationalString getRemarks()
          Comments on or information about this identifier, or if none.
 org.opengis.util.GenericName getScope()
          Returns the scope (name space) of this generic name.
 java.lang.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 identifier.
 org.opengis.util.InternationalString toInternationalString()
          Returns a local-dependent string representation of this generic name.
 java.lang.String toString()
          Returns a string representation of this generic name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NamedIdentifier

public NamedIdentifier(java.util.Map properties)
                throws java.lang.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"   String   getCode()
 "authority"   String or Citation   getAuthority()
 "version"   String   getVersion()
 "remarks"   String or InternationalString   getRemarks()

"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.

Throws:
org.opengis.parameter.InvalidParameterValueException - if a property has an invalid value.
java.lang.IllegalArgumentException - if a property is invalid for some other reason.

NamedIdentifier

public NamedIdentifier(org.opengis.metadata.citation.Citation authority,
                       org.opengis.util.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. OGC or EPSG).
code - The code. The English name is used for the code, and the international string is used for the generic name.

NamedIdentifier

public NamedIdentifier(org.opengis.metadata.citation.Citation authority,
                       java.lang.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.

Parameters:
authority - The authority (e.g. OGC or EPSG).
code - The code. This parameter is mandatory.

NamedIdentifier

public NamedIdentifier(org.opengis.metadata.citation.Citation authority,
                       java.lang.String code,
                       java.lang.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.

Parameters:
authority - The authority (e.g. OGC or EPSG).
code - The code. This parameter is mandatory.
version - The version, or if none.
Method Detail

getCode

public java.lang.String getCode()
Identifier code or name, optionally from a controlled list or pattern.

Specified by:
getCode in interface org.opengis.metadata.Identifier
Returns:
The code.

getAuthority

public org.opengis.metadata.citation.Citation getAuthority()
Organization or party responsible for definition and maintenance of the code.

Specified by:
getAuthority in interface org.opengis.metadata.Identifier
Returns:
The authority, or if not available.

getVersion

public java.lang.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:
getVersion in interface org.opengis.metadata.Identifier
Returns:
The version, or if not available.

getRemarks

public org.opengis.util.InternationalString getRemarks()
Comments on or information about this identifier, or if none.


getScope

public org.opengis.util.GenericName getScope()
Returns the scope (name space) of this generic name. If this name has no scope (e.g. is the root), then this method returns .

Specified by:
getScope in interface org.opengis.util.GenericName

asScopedName

public org.opengis.util.ScopedName asScopedName()
Returns a view of this object as a scoped name, or if this name has no scope.

Specified by:
asScopedName in interface org.opengis.util.GenericName

asLocalName

public org.opengis.util.LocalName asLocalName()
Returns a view of this object as a local name. The local name returned by this method will have the same scope than this generic name.

Specified by:
asLocalName in interface org.opengis.util.GenericName

getParsedNames

public java.util.List 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:
getParsedNames in interface org.opengis.util.GenericName

toInternationalString

public org.opengis.util.InternationalString toInternationalString()
Returns a local-dependent string representation of this generic name. This string is similar to the one returned by toString() except that each element has been localized in the specified locale. If no international string is available, then this method returns an implementation mapping to toString() for all locales.

Specified by:
toInternationalString in interface org.opengis.util.GenericName

toString

public java.lang.String toString()
Returns a string representation of this generic name. This string representation is local-independant. It contains all elements listed by getParsedNames() separated by an arbitrary character (usually or ).

Specified by:
toString in interface org.opengis.util.GenericName

compareTo

public int compareTo(java.lang.Object 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:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object object)
Compares this identifier with the specified object for equality.


hashCode

public int hashCode()
Returns a hash code value for this identifier.



Copyright © GeoTools. All Rights Reserved.