Class AbstractName
- All Implemented Interfaces:
- Serializable,- Comparable<GenericName>,- GenericName
- Direct Known Subclasses:
- DefaultLocalName,- DefaultScopedName
The easiest way to create a name is to use the Names.createLocalName(CharSequence, String, CharSequence)
 convenience static method. That method supports the common case where the name is made only of a
 (namespace, local part) pair of strings. However, generic names allows finer grain.
 For example, the above-cited strings can both be split into smaller name components.
 If such finer grain control is desired, DefaultNameFactory can be used instead of Names.
Natural ordering
This class has a natural ordering that is inconsistent withequals(Object).
 See compareTo(GenericName) for more information.
 Note for implementers
Subclasses need only to implement the following methods: Subclasses shall make sure that any overridden methods remain safe to call from multiple threads and do not change any publicGenericName state.- Since:
- 0.3
- See Also:
Defined in the sis-metadata module
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic AbstractNamecastOrCopy(GenericName object) Returns a SIS name implementation with the values of the given arbitrary implementation.intcompareTo(GenericName name) Compares this name with the specified name for order.intdepth()Indicates the number of levels specified by this name.booleanCompares this generic name with the specified object for equality.abstract List<? extends LocalName>Returns the sequence of local names making this generic name.intReturns a hash code value for this generic name.head()Returns the first element in the sequence of parsed names.push(GenericName scope) Returns this name expanded with the specified scope.abstract NameSpacescope()Returns the scope (name space) in which this name is local.tip()Returns the last element in the sequence of parsed names.Returns a view of this name as a fully-qualified name.Returns a local-dependent string representation of this generic name.Returns a string representation of this generic name.
- 
Constructor Details- 
AbstractNameprotected AbstractName()Creates a new instance of generic name.
 
- 
- 
Method Details- 
castOrCopyReturns a SIS name implementation with the values of the given arbitrary implementation. This method performs the first applicable action in the following choices:- If the given object is null, then this method returnsnull.
- Otherwise if the given object is an instance of LocalName, then this method delegates toDefaultLocalName.castOrCopy(LocalName).
- Otherwise if the given object is already an instance of AbstractName, then it is returned unchanged.
- Otherwise a new instance of an AbstractNamesubclass is created using theDefaultNameFactory.createGenericName(NameSpace, CharSequence[])method.
 - Parameters:
- object- the object to get as a SIS implementation, or- nullif none.
- Returns:
- a SIS implementation containing the values of the given object (may be the
         given object itself), or nullif the argument was null.
 
- If the given object is 
- 
scopeReturns the scope (name space) in which this name is local. For example if a fully qualified name is"org.opengis.util.Record"and if this instance is the"util.Record"part, then its scope is named"org.opengis".Continuing with the above example, the full "org.opengis.util.Record"name has no scope. If this method is invoked on such name, then the SIS implementation returns a global scope instance (i.e. an instance for whichDefaultNameSpace.isGlobal()returnstrue) which is unique and named"global".- Specified by:
- scopein interface- GenericName
- Returns:
- the scope of this name.
 
- 
depthpublic int depth()Indicates the number of levels specified by this name. The default implementation returns the size of the list returned by thegetParsedNames()method.- Specified by:
- depthin interface- GenericName
- Returns:
- the depth of this name.
 
- 
getParsedNamesReturns the sequence of local names making this generic name. The length of this sequence is the depth. It does not include the scope.- Specified by:
- getParsedNamesin interface- GenericName
- Returns:
- the local names making this generic name, without the scope.
         Shall never be nullneither empty.
 
- 
headReturns the first element in the sequence of parsed names. For anyLocalName, this is alwaysthis.Example: Ifthisname is"org.opengis.util.Record"(no matter its scope, then this method returns"org".- Specified by:
- headin interface- GenericName
- Returns:
- the first element in the list of parsed names.
 
- 
tipReturns the last element in the sequence of parsed names. For anyLocalName, this is alwaysthis.Example: Ifthisname is"org.opengis.util.Record"(no matter its scope, then this method returns"Record".- Specified by:
- tipin interface- GenericName
- Returns:
- the last element in the list of parsed names.
 
- 
toFullyQualifiedNameReturns a view of this name as a fully-qualified name. The scope of a fully qualified name is global. If the scope of this name is already global, then this method returnsthis.- Specified by:
- toFullyQualifiedNamein interface- GenericName
- Returns:
- the fully-qualified name (never null).
 
- 
pushReturns this name expanded with the specified scope. One may represent this operation as a concatenation of the specifiedscopewiththis. For example, ifthisname is"util.Record"and the givenscopeargument is"org.opengis", thenthis.push(scope)shall return"org.opengis.util.Record".- Specified by:
- pushin interface- GenericName
- Parameters:
- scope- the name to use as prefix.
- Returns:
- a concatenation of the given scope with this name.
 
- 
toStringReturns a string representation of this generic name. This string representation is local-independent. It contains all elements listed bygetParsedNames()separated by a namespace-dependent character (usually':'or'/'). This rule implies that the result may or may not be fully qualified. Special cases:- toFullyQualifiedName().toString()is guaranteed to contain the scope (if any).
- tip().toString()is guaranteed to not contain any scope.
 - Specified by:
- toStringin interface- GenericName
- Overrides:
- toStringin class- Object
- Returns:
- a local-independent string representation of this name.
 
- 
toInternationalStringReturns a local-dependent string representation of this generic name. This string is similar to the one returned bytoString()except that each element has been localized in the specified locale. If no international string is available, then this method returns an implementation mapping totoString()for all locales.- Specified by:
- toInternationalStringin interface- GenericName
- Returns:
- a localizable string representation of this name.
 
- 
compareToCompares this name with the specified name for order. Returns a negative integer, zero, or a positive integer as this name lexicographically precedes, is equal to, or follows the specified name. The comparison is performed in the following way:- For each element of the list of parsed names taken
       in iteration order, compare the LocalName. If a name lexicographically precedes or follows the corresponding element of the specified name, returns a negative or a positive integer respectively.
- If all elements in both names are lexicographically equal, then if this name has less or more elements than the specified name, returns a negative or a positive integer respectively.
- Otherwise, returns 0.
 - Specified by:
- compareToin interface- Comparable<GenericName>
- Parameters:
- name- the other name to compare with this name.
- Returns:
- -1 if this name precedes the given one, +1 if it follows, 0 if equals.
 
- For each element of the list of parsed names taken
       in iteration order, compare the 
- 
equalsCompares this generic name with the specified object for equality. The default implementation returnstrueif the scopes and the lists of parsed names are equal.
- 
hashCodepublic int hashCode()Returns a hash code value for this generic name.
 
-