|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFormattableObject
AbstractIdentifiedObject
@Immutable @ThreadSafe public class AbstractIdentifiedObject
A base class for metadata applicable to reference system objects. When AuthorityFactory
is used to create an object, the authority and
authority code values are set to the authority
name of the factory object, and the authority code supplied by the client, respectively. When
ObjectFactory creates an object, the name is set to the value
supplied by the client and all of the other metadata items are left empty.
This class is conceptually abstract, even if it is technically possible to
instantiate it. Typical applications should create instances of the most specific subclass with
Default prefix instead. An exception to this rule may occurs when it is not possible to
identify the exact type. For example it is not possible to infer the exact coordinate system from
Well
Known Text is some cases (e.g. in a LOCAL_CS element). In such exceptional
situation, a plain AbstractCS object may be instantiated.
| referencing/geotk-referencing (download) | View source code for this class |
| Field Summary |
|---|
| Fields inherited from class FormattableObject |
|---|
EPSG, GEOTIFF, INTERNAL, OGC, SINGLE_LINE |
| Fields inherited from interface IdentifiedObject |
|---|
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY |
| Constructor Summary | |
|---|---|
|
AbstractIdentifiedObject(IdentifiedObject object)
Constructs a new identified object with the same values than the specified one. |
|
AbstractIdentifiedObject(Map<String,?> properties)
Constructs an object from a set of properties. |
protected |
AbstractIdentifiedObject(Map<String,?> properties,
Map<String,Object> subProperties,
String[] localizables)
Constructs an object from a set of properties and copy unrecognized properties in the specified map. |
| Method Summary | |
|---|---|
protected int |
computeHashCode()
Computes a hash value for this identified object. |
boolean |
equals(Object object)
Compares the specified object with this object for equality. |
boolean |
equals(Object object,
ComparisonMode mode)
Compares this object with the specified object for equality. |
Collection<GenericName> |
getAlias()
An alternative name by which this object is identified. |
ReferenceIdentifier |
getIdentifier(Citation authority)
Returns an identifier according the given authority. |
Set<ReferenceIdentifier> |
getIdentifiers()
An identifier which references elsewhere the object's defining information. |
ReferenceIdentifier |
getName()
The primary name by which this object is identified. |
String |
getName(Citation authority)
Returns this object name according the given authority. |
InternationalString |
getRemarks()
Comments on or information about this object, including data source information. |
int |
hashCode()
Returns a hash value for this identified object. |
boolean |
nameMatches(String name)
Returns true if either the primary name or at least
one alias matches the specified string. |
| Methods inherited from class FormattableObject |
|---|
formatWKT, getDefaultIndentation, print, setDefaultIndentation, toString, toWKT, toWKT, toWKT |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface IdentifiedObject |
|---|
toWKT |
| Constructor Detail |
|---|
public AbstractIdentifiedObject(IdentifiedObject object)
object - The object to copy.
public AbstractIdentifiedObject(Map<String,?> properties)
throws IllegalArgumentException
"name" property. Other properties listed
in the table below are optional.
| Property name | Value type | Value given to |
|---|---|---|
| "name" | String or ReferenceIdentifier |
getName() |
| "alias" | CharSequence, GenericName or an array of those |
getAlias() |
| "authority" | String or Citation |
Identifier.getAuthority() on the name |
| "codespace" | String |
ReferenceIdentifier.getCodeSpace() on the name |
| "version" | String |
ReferenceIdentifier.getVersion() on the name |
| "identifiers" | ReferenceIdentifier or ReferenceIdentifier[] |
getIdentifiers() |
| "remarks" | String or InternationalString |
getRemarks() |
Additionally, all localizable attributes like "remarks" 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.
Note that the "authority" and "version" properties are ignored if the
"name" property is already a Citation object instead of a String.
properties - The properties to be given to this identified object.
IllegalArgumentException - if a property has an invalid value.
protected AbstractIdentifiedObject(Map<String,?> properties,
Map<String,Object> subProperties,
String[] localizables)
throws IllegalArgumentException
properties argument is treated as in the one argument constructor. All
properties unknown to this AbstractIdentifiedObject constructor are copied
in the subProperties map, after their key has been normalized (usually
lower case, leading and trailing space removed).
If localizables is non-null, then all keys listed in this argument are
treated as localizable one (i.e. may have a suffix like "_fr", "_de", etc.). Localizable
properties are stored in the subProperties map as InternationalString
objects.
properties - Set of properties. Should contains at least "name".subProperties - The map in which to copy unrecognized properties.localizables - Optional list of localized properties.
IllegalArgumentException - if a property has an invalid value.| Method Detail |
|---|
public ReferenceIdentifier getName()
getName in interface IdentifiedObjectgetName(Citation)public String getName(Citation authority)
If the name or alias implements the ReferenceIdentifier interface,
then this method compares the identifier authority against the specified citation using the
identifierMatches
method. If a matching is found, then this method returns the
identifier code of this object.
Otherwise, if the alias implements the GenericName interface, then this
method compares the name scope against the specified
citation using the identifierMatches method. If a matching is found, then this method returns the
name tip of this object.
ReferenceIdentifier and GenericName
interfaces (for example NamedIdentifier). In such cases, the identifier view has
precedence.
authority - The authority for the name to return, or null for any authority.
null if
no name matching the specified authority was found.getName(),
getAlias(),
IdentifiedObjects.getName(IdentifiedObject, Citation)public Collection<GenericName> getAlias()
getAlias in interface IdentifiedObjectgetName(Citation)public Set<ReferenceIdentifier> getIdentifiers()
getIdentifiers in interface IdentifiedObjectgetIdentifier(Citation)public ReferenceIdentifier getIdentifier(Citation authority)
authority - The authority for the identifier to return, or null for
the first identifier regardless its authority.
null if no identifier matching the specified
authority was found.IdentifiedObjects.getIdentifier(IdentifiedObject, Citation)public InternationalString getRemarks()
getRemarks in interface IdentifiedObjectpublic boolean nameMatches(String name)
true if either the primary name or at least
one alias matches the specified string. This method performs
the search in the following order, regardless of any authority:
name - The name to compare.
true if the primary name of at least one alias
matches the specified name.IdentifiedObjects.nameMatches(IdentifiedObject, String)public final boolean equals(Object object)
return equals(other, ComparisonMode.STRICT);
equals in interface LenientComparableequals in class Objectobject - The other object (may be null).
true if both objects are equal.
public boolean equals(Object object,
ComparisonMode mode)
mode is STRICT, then all available properties
are compared including name, remarks,
identifiers code, etc.mode is IGNORE_METADATA, then this
method compare only the properties needed for computing transformations. In other
words, sourceCS.equals(targetCS, false) returns true only if the
transformation from sourceCS to targetCS is the identity transform,
no matter what getName() said.
Some subclasses (especially AbstractDatum
and AbstractParameterDescriptor) will test for the
name, since objects with different name have completely
different meaning. For example nothing differentiate the "semi_major" and
"semi_minor" parameters except the name. The name comparison may be loose
however, i.e. we may accept a name matching an alias.
equals in interface LenientComparableobject - The object to compare to this.mode - STRICT for performing a strict comparison, or
IGNORE_METADATA for comparing only properties
relevant to transformations.
true if both objects are equal.public final int hashCode()
computeHashCode()
when first needed and caches the value for future invocations. Subclasses should override
computeHashCode() instead than this method.
Implementation specific feature
In the Geotk implementation, the name, identifiers and remarks are not used for hash code computation.
Consequently two identified objects will return the same hash value if they are equal in the
sense of equals(…,
ComparisonMode.IGNORE_METADATA). This feature allows users to
implement metadata-insensitive HashMap.
hashCode in class Objectprotected int computeHashCode()
hashCode() when first needed.
Implementation specific feature
In the Geotk implementation, the name, identifiers and remarks are not used for hash code computation.
Consequently two identified objects will return the same hash value if they are equal in the
sense of equals(…,
ComparisonMode.IGNORE_METADATA). This feature allows users to
implement metadata-insensitive HashMap.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||