public class NamedIdentifier extends ImmutableIdentifier implements GenericName
Identifier 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 Identifier instances are required, like GML marshalling time.
GenericName attributes will be inferred from Identifier attributes as below:
authority = new DefaultCitation("IOGP"),
codeSpace = "EPSG" and code = "4326", then the name attributes will be
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.DefaultIdentifier,
AbstractName,
AbstractIdentifiedObject.getName(),
Serialized FormDefined in the sis-referencing module
DESCRIPTION_KEYCODESPACE_KEY, VERSION_KEYAUTHORITY_KEY, CODE_KEY| Constructor and Description |
|---|
NamedIdentifier(Citation authority,
CharSequence code)
Constructs an identifier from an authority and code.
|
NamedIdentifier(Citation authority,
String codeSpace,
CharSequence code,
String version,
InternationalString description)
Constructs an identifier from an authority and localizable code,
with an optional version number and description.
|
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, getDescription, getVersionprint, toString, toWKTpublic 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
"name" property.
| Property name | Value type | Returned by |
|---|---|---|
"name" |
GenericName |
(none) |
| Defined in parent class (reminder) | ||
| "code" | String |
ImmutableIdentifier.getCode() |
| "codespace" | String |
ImmutableIdentifier.getCodeSpace() |
| "authority" | String or Citation |
ImmutableIdentifier.getAuthority() |
| "version" | String |
ImmutableIdentifier.getVersion() |
| "description" | String or InternationalString |
ImmutableIdentifier.getDescription() |
| "locale" | Locale |
(none) |
"name" property is provided, then calls to name-related methods like
tip(), head() and scope() will delegate to the given name.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, CharSequence code)
If the given code is an InternationalString, then 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.
authority - organization or party responsible for definition and maintenance of the code space or code,
or null if not available.code - identifier code or name, optionally from a controlled list or pattern defined by the authority.
The code can not be null.public NamedIdentifier(Citation authority, String codeSpace, CharSequence code, String version, InternationalString description)
If the given code is an InternationalString, then 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.
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.description - natural language description of the meaning of the code value, or null if none.public LocalName tip()
tip in interface GenericNameImmutableIdentifier.getCode()public LocalName head()
head in interface GenericNamescope(),
ImmutableIdentifier.getCodeSpace()public NameSpace scope()
authority provided as a name space.scope in interface GenericNamehead(),
ImmutableIdentifier.getAuthority()public int depth()
depth in interface GenericNamepublic List<? extends LocalName> getParsedNames()
getParsedNames in interface GenericNamenull neither empty.public ScopedName push(GenericName scope)
name with this.push in interface GenericNamescope - The name to use as prefix.public GenericName toFullyQualifiedName()
toFullyQualifiedName in interface GenericNamenull).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 GenericNamepublic String toString()
getParsedNames()
separated by a namespace-dependent character (usually : or /).toString in interface GenericNametoString in class FormattableObjectIdentifiedObjects.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 ImmutableIdentifierobject - the object to compare with this name.true if the given object is equal to this name.public int hashCode()
hashCode in class ImmutableIdentifierCopyright © 2010–2017 The Apache Software Foundation. All rights reserved.