public class NamedIdentifier extends ImmutableIdentifier implements GenericName
ReferenceIdentifier
and a GenericName
.
This class implements both interfaces in order to allow usage of the same instance either as an object
name or alias.
This flexibility make easier to uses object's names in two different models:
RS_Identifier
and an arbitrary amount
of aliases of type GenericName
.gml:CodeType
,
but do not have any alias.NamedIdentifier
class, users can declare supplemental object's names as
aliases and have those names used in contexts
where ReferenceIdentifier
instances are required, like GML marshalling time.
GenericName
attributes will be inferred from ReferenceIdentifier
attributes as below:
authority
= Citations.OGP
, codeSpace
= "EPSG"
and code
= "4326"
, then the name attributes will be scope
= "OGP"
,
head
= "EPSG"
, tip
= "4326"
and toString()
= "EPSG:4326"
.
Note that the scope does not appear in the string representation of names.Citation
and InternationalString
arguments given to the constructor are also immutable. It is caller's responsibility to ensure that those
conditions hold, for example by invoking DefaultCitation.freeze()
before passing the arguments to the constructor.
Subclasses shall make sure that any overridden methods remain safe to call from multiple threads and do not change
any public NamedIdentifier
state.Defined in the sis-referencing
module
CODESPACE_KEY, VERSION_KEY
AUTHORITY_KEY, CODE_KEY
Constructor and Description |
---|
NamedIdentifier(Citation authority,
InternationalString code)
Constructs an identifier from an authority and localizable code.
|
NamedIdentifier(Citation authority,
String code)
Constructs an identifier from an authority and code.
|
NamedIdentifier(Citation authority,
String codeSpace,
String code,
String version,
InternationalString remarks)
Creates an identifier from the specified code and authority,
with an optional version number and remarks.
|
NamedIdentifier(GenericName name)
Creates a new identifier from the specified name.
|
NamedIdentifier(Map<String,?> properties)
Constructs an identifier from the given properties.
|
NamedIdentifier(ReferenceIdentifier identifier)
Creates a new identifier from the specified one.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(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(Object object)
Compares this identifier with the specified object for equality.
|
List<? extends LocalName> |
getParsedNames()
Returns the sequence of local names making this generic name.
|
int |
hashCode()
Returns a hash code value for this object.
|
LocalName |
head()
Returns the first element in the sequence of parsed names.
|
ScopedName |
push(GenericName scope)
Returns this name expanded with the specified scope.
|
NameSpace |
scope()
Returns the scope (name space) in which this name is local.
|
LocalName |
tip()
The last element in the sequence of parsed names.
|
GenericName |
toFullyQualifiedName()
Returns a view of this name as a fully-qualified name.
|
InternationalString |
toInternationalString()
Returns a local-dependent string representation of this generic name.
|
String |
toString()
Returns a string representation of this generic name.
|
castOrCopy, formatTo, getAuthority, getCode, getCodeSpace, getRemarks, getVersion, isDeprecated
print, toString, toWKT
public NamedIdentifier(ReferenceIdentifier identifier)
If the given identifier implements the GenericName
interface, then calls to
tip()
, head()
, scope()
and similar methods will delegate
to that name.
identifier
- The identifier to copy.public NamedIdentifier(GenericName name)
tip()
,
head()
and scope()
will delegate to the given name.name
- The name to wrap.public NamedIdentifier(Map<String,?> properties) throws IllegalArgumentException
properties
- The properties to be given to this identifier.InvalidParameterValueException
- if a property has an invalid value.IllegalArgumentException
- if a property is invalid for some other reason.public NamedIdentifier(Citation authority, InternationalString code)
authority
- The authority (e.g. Citations.OGC
or Citations.EPSG
),
or null
if not available.code
- The code. The code.toString(Locale.ROOT)
return value will be used for the
code
property, and the complete international string will be used
for the name
property.public NamedIdentifier(Citation authority, String code)
authority
- The authority (e.g. Citations.OGC
or Citations.EPSG
),
or null
if not available.code
- The code. This parameter is mandatory.public NamedIdentifier(Citation authority, String codeSpace, String code, String version, InternationalString remarks)
authority
- Organization or party responsible for definition and maintenance of the code
space or code, or null
if not available.codeSpace
- Name or identifier of the person or organization responsible for namespace, or
null
if not available. This is often an abbreviation of the authority name.code
- Identifier code or name, optionally from a controlled list or pattern defined by
a code space. The code can not be null.version
- The version of the associated code space or code as specified by the code authority,
or null
if none.remarks
- Comments on or information about this identifier, or null
if none.public LocalName tip()
tip
in interface GenericName
ImmutableIdentifier.getCode()
public LocalName head()
head
in interface GenericName
scope()
,
ImmutableIdentifier.getCodeSpace()
public NameSpace scope()
authority
provided as a name space.scope
in interface GenericName
head()
,
ImmutableIdentifier.getAuthority()
public int depth()
depth
in interface GenericName
public List<? extends LocalName> getParsedNames()
getParsedNames
in interface GenericName
null
neither empty.public ScopedName push(GenericName scope)
name
with this
.push
in interface GenericName
scope
- The name to use as prefix.public GenericName toFullyQualifiedName()
toFullyQualifiedName
in interface GenericName
null
).public InternationalString toInternationalString()
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.toInternationalString
in interface GenericName
public String toString()
getParsedNames()
separated by a namespace-dependent character (usually :
or /
).toString
in interface GenericName
toString
in class FormattableObject
IdentifiedObjects.toString(Identifier)
public int compareTo(GenericName object)
compareTo
in interface Comparable<GenericName>
object
- The object to compare with.public boolean equals(Object object)
equals
in class ImmutableIdentifier
object
- The object to compare with this name.true
if the given object is equal to this name.public int hashCode()
hashCode
in class ImmutableIdentifier
Copyright © 2010–2014 The Apache Software Foundation. All rights reserved.