org.cts
Class Identifier

java.lang.Object
  extended by org.cts.Identifier
All Implemented Interfaces:
Identifiable

public class Identifier
extends Object
implements Identifiable

Identifier used to identify objects such as Datums, Ellipsoids or CoordinateReferenceSystems.

Identifier encapsulates all identification info of Identifiable objects in a special instance to make object creation clearer.

Identifier also offers new unique ids for every object created in the LOCAL namespace.

Author:
Michaƫl Michaud
See Also:
Identifiable, IdentifiableComponent

Field Summary
 
Fields inherited from interface org.cts.Identifiable
DEFAULT, LOCAL, UNKNOWN
 
Constructor Summary
Identifier(Class clazz)
          Creates a local identifier.
Identifier(Class clazz, String name)
          Create a local identifier.
Identifier(Class clazz, String name, String shortName)
          Create a local identifier.
Identifier(Class clazz, String name, String shortName, List<Identifiable> aliases)
          Create a local identifier.
Identifier(String authorityName, String authorityKey, String name)
          Creates a complete identifier.
Identifier(String authorityName, String authorityKey, String name, String shortName)
          Creates a complete identifier.
Identifier(String authorityName, String authorityKey, String name, String shortName, String remarks, List<Identifiable> aliases)
          Creates a complete identifier.
 
Method Summary
 boolean addAlias(Identifiable alias)
          Add an alias
 void addRemark(String new_remark)
          Add remarks.
 boolean equals(Object object)
          Returns true if object is equals to this.
 List<Identifiable> getAliases()
          Get aliases
 String getAuthorityKey()
          Returns the key of this identifier (id must be unique inside the authority name).
 String getAuthorityName()
          Return the authority name of this identifier (ex.
 String getCode()
          Returns a code formed with a namespace, ':' and the id value of identifier (ex.
 String getName()
          Returns a string used to identify clearly the object.
static int getNewId()
          Return an identifier which is unique for this program session.
 String getRemarks()
          Returns remarks.
 String getShortName()
          Returns a short string used to identify unambiguously the object.
 int hashCode()
          Returns the hash code for this Identifier.
 void setRemarks(String remarks)
          Change the remarks.
 void setShortName(String shortName)
          Change the short string used to identify unambiguously the object.
 String toString()
          Returns a String representation of this identifier.
 String toWKT()
          Returns a WKT representation of the identifier.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Identifier

public Identifier(String authorityName,
                  String authorityKey,
                  String name,
                  String shortName,
                  String remarks,
                  List<Identifiable> aliases)
Creates a complete identifier.

Parameters:
authorityName - namespace of the identifier ie EPSG, IGNF
authorityKey - unique key in the namespace
name - name or description
shortName - short name used for user interfaces
remarks - remarks containing additionnal information on the object
aliases - synonyms of this Identifiable

Identifier

public Identifier(Class clazz)
Creates a local identifier.

Parameters:
clazz - the class of the identified object

Identifier

public Identifier(Class clazz,
                  String name)
Create a local identifier.

Parameters:
clazz - the class of the identified object
name - the name of the identified object

Identifier

public Identifier(Class clazz,
                  String name,
                  String shortName)
Create a local identifier.

Parameters:
clazz - the class of the identified object
name - the name of the identified object
shortName - the short name of the identified object

Identifier

public Identifier(Class clazz,
                  String name,
                  String shortName,
                  List<Identifiable> aliases)
Create a local identifier.

Parameters:
clazz - the class of the identified object
name - the name of the identified object
shortName - the short name of the identified object
aliases - synonyms of this Identifiable

Identifier

public Identifier(String authorityName,
                  String authorityKey,
                  String name)
Creates a complete identifier.

Parameters:
authorityName - ie EPSG, IGNF
authorityKey - ie 4326, LAMB
name -

Identifier

public Identifier(String authorityName,
                  String authorityKey,
                  String name,
                  String shortName)
Creates a complete identifier.

Parameters:
authorityName - ie EPSG, IGNF
authorityKey - ie 4326, LAMB
name -
shortName - a short name to use in user interfaces
Method Detail

getNewId

public static int getNewId()
Return an identifier which is unique for this program session. This identifier is usually associated with the LOCAL namespace


getAuthorityName

public String getAuthorityName()
Return the authority name of this identifier (ex. EPSG, IGN-F) The namespace may represent a database name, a URL, a URN...

Specified by:
getAuthorityName in interface Identifiable

getAuthorityKey

public String getAuthorityKey()
Returns the key of this identifier (id must be unique inside the authority name).

Specified by:
getAuthorityKey in interface Identifiable

getCode

public String getCode()
Returns a code formed with a namespace, ':' and the id value of identifier (ex. EPSG:27572).

Specified by:
getCode in interface Identifiable
Returns:
a String of the form namespace:identifier

getName

public String getName()
Returns a string used to identify clearly the object.

Specified by:
getName in interface Identifiable

getShortName

public String getShortName()
Returns a short string used to identify unambiguously the object. A short name should have less than 16 characters whenever possible, and should never exceed 48 characters.

Specified by:
getShortName in interface Identifiable

setShortName

public void setShortName(String shortName)
Change the short string used to identify unambiguously the object. A short name should have less than 16 characters whenever possible, and should never exceed 48 characters.

Specified by:
setShortName in interface Identifiable
Parameters:
shortName - the new short name for the Identifier

getRemarks

public String getRemarks()
Returns remarks.

Specified by:
getRemarks in interface Identifiable

setRemarks

public void setRemarks(String remarks)
Change the remarks. Be careful, this method will delete former remarks.

Specified by:
setRemarks in interface Identifiable
Parameters:
remarks - the new remarks on this identifier

addRemark

public void addRemark(String new_remark)
Add remarks.

Specified by:
addRemark in interface Identifiable
Parameters:
new_remark - the remark to add to the Identifier's remarks

getAliases

public List<Identifiable> getAliases()
Get aliases

Specified by:
getAliases in interface Identifiable

addAlias

public boolean addAlias(Identifiable alias)
Add an alias

Specified by:
addAlias in interface Identifiable
Parameters:
alias - an alias for this object

toWKT

public String toWKT()
Returns a WKT representation of the identifier.


equals

public boolean equals(Object object)
Returns true if object is equals to this. Test equality between codes (namespace + id), then between aliases.

Overrides:
equals in class Object
Parameters:
object - The object to compare this Identifier against

hashCode

public int hashCode()
Returns the hash code for this Identifier.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a String representation of this identifier.

Overrides:
toString in class Object


Copyright © 2014 IRSTV CNRS-FR-2488. All Rights Reserved.