org.geotools.referencing
Class NamedIdentifier

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

public class NamedIdentifier
extends java.lang.Object
implements org.opengis.referencing.ReferenceIdentifier, org.opengis.util.GenericName, java.lang.Comparable<org.opengis.util.GenericName>, java.io.Serializable

An identification of a CRS object. The main interface implemented by this class is ReferenceIdentifier. However, this class also implements GenericName in 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
Version:
$Id: NamedIdentifier.java 31445 2008-09-07 18:14:23Z desruisseaux $
Author:
Martin Desruisseaux (IRD)
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.opengis.referencing.ReferenceIdentifier
CODESPACE_KEY, VERSION_KEY
 
Fields inherited from interface org.opengis.metadata.Identifier
AUTHORITY_KEY, CODE_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<java.lang.String,?> properties)
          Constructs an identifier from a set of properties.
 
Method Summary
 org.opengis.util.LocalName asLocalName()
          Deprecated. Replaced by tip().
 org.opengis.util.ScopedName asScopedName()
          Deprecated. Replaced by toFullyQualifiedName().
 int compareTo(org.opengis.util.GenericName object)
          Compares this name with the specified object for order.
 int depth()
          Returns the depth of this name within the namespace hierarchy.
 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.lang.String getCodeSpace()
          Name or identifier of the person or organization responsible for namespace.
 java.util.List<org.opengis.util.LocalName> getParsedNames()
          Returns the sequence of local names making this generic name.
 org.opengis.util.InternationalString getRemarks()
          Comments on or information about this identifier, or null if none.
 org.opengis.util.GenericName getScope()
          Deprecated. Replaced by scope().
 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.LocalName head()
          Returns the first element in the sequence of parsed names.
 org.opengis.util.LocalName name()
          Deprecated. Replaced by tip().
 org.opengis.util.ScopedName push(org.opengis.util.GenericName scope)
          Returns this name expanded with the specified scope.
 org.opengis.util.NameSpace scope()
          Returns the scope (name space) in which this name is local.
 org.opengis.util.LocalName tip()
          Returns the last element in the sequence of parsed names.
 org.opengis.util.GenericName toFullyQualifiedName()
          Returns a view of this name as a fully-qualified name.
 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<java.lang.String,?> 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()
 "code"   String   getCodeSpace()
 "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.

Parameters:
properties - The properties to be given to this identifier.
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 null 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.

getCodeSpace

public java.lang.String getCodeSpace()
Name or identifier of the person or organization responsible for namespace.

Specified by:
getCodeSpace in interface org.opengis.referencing.ReferenceIdentifier
Returns:
The codespace, or null if not available.

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 null 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.referencing.ReferenceIdentifier
Returns:
The version, or null if not available.

getRemarks

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

Returns:
Optional comments about this identifier.

head

public org.opengis.util.LocalName head()
Returns the first element in the sequence of parsed names.

Specified by:
head in interface org.opengis.util.GenericName
Since:
2.6

tip

public org.opengis.util.LocalName tip()
Returns the last element in the sequence of parsed names.

Specified by:
tip in interface org.opengis.util.GenericName
Since:
2.3

name

@Deprecated
public org.opengis.util.LocalName name()
Deprecated. Replaced by tip().

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

asLocalName

@Deprecated
public org.opengis.util.LocalName asLocalName()
Deprecated. Replaced by tip().

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.


scope

public org.opengis.util.NameSpace scope()
Returns the scope (name space) in which this name is local.

Specified by:
scope in interface org.opengis.util.GenericName
Since:
2.3

getScope

public org.opengis.util.GenericName getScope()
Deprecated. Replaced by scope().

Returns the scope (name space) of this generic name. If this name has no scope (e.g. is the root), then this method returns null.


depth

public int depth()
Returns the depth of this name within the namespace hierarchy.

Specified by:
depth in interface org.opengis.util.GenericName
Since:
2.3

getParsedNames

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

push

public org.opengis.util.ScopedName push(org.opengis.util.GenericName scope)
Returns this name expanded with the specified scope. One may represent this operation as a concatenation of the specified name with this.

Specified by:
push in interface org.opengis.util.GenericName
Since:
2.3

toFullyQualifiedName

public org.opengis.util.GenericName toFullyQualifiedName()
Returns a view of this name as a fully-qualified name.

Specified by:
toFullyQualifiedName in interface org.opengis.util.GenericName
Since:
2.3

asScopedName

@Deprecated
public org.opengis.util.ScopedName asScopedName()
Deprecated. Replaced by toFullyQualifiedName().

Returns a view of this object as a scoped name, or null if this name has no scope.


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
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(org.opengis.util.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:
compareTo in interface java.lang.Comparable<org.opengis.util.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(java.lang.Object object)
Compares this identifier with the specified object for equality.

Overrides:
equals in class java.lang.Object
Parameters:
object - The object to compare with this name.
Returns:
true if the given object is equals to this name.

hashCode

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

Overrides:
hashCode in class java.lang.Object


Copyright © 1996-2010 Geotools. All Rights Reserved.