Package org.apache.sis.util.iso
Class DefaultLocalName
Object
AbstractName
DefaultLocalName
- All Implemented Interfaces:
- Serializable,- Comparable<GenericName>,- GenericName,- LocalName
- Direct Known Subclasses:
- DefaultMemberName,- DefaultTypeName
Identifier within a name space for a local object.
 Local names are names which are directly accessible to and maintained by a name space.
 Names are local to one and only one name space.
 The name space within which they are local is indicated by the scope.
 
DefaultLocalName can be instantiated by any of the following methods:
- DefaultNameFactory.createLocalName(NameSpace, CharSequence).
- DefaultNameFactory.createGenericName(NameSpace, CharSequence[])with an array of length 1.
- DefaultNameFactory.parseGenericName(NameSpace, CharSequence)with no occurrence of the separator in the path.
- Similar static convenience methods in Names.
Immutability and thread safety
This class is immutable and thus inherently thread-safe if theNameSpace and CharSequence
 arguments given to the constructor are also immutable. Subclasses shall make sure that any overridden methods
 remain safe to call from multiple threads and do not change any public LocalName state.- Since:
- 0.3
- See Also:
Defined in the sis-metadata module
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedDefaultLocalName(NameSpace scope, CharSequence name) Constructs a local name from the given character sequence.
- 
Method SummaryModifier and TypeMethodDescriptionstatic DefaultLocalNamecastOrCopy(LocalName object) Returns a SIS local name implementation with the values of the given arbitrary implementation.intcompareTo(GenericName name) Compares this name with the specified object for order.final intdepth()Returns the depth, which is always 1 for a local name.booleanCompares this local name with the specified object for equality.final List<DefaultLocalName>Returns the sequence of local name for this name.final LocalNamehead()Returnsthissince this object is already a local name.scope()Returns the scope (name space) in which this name is local.final LocalNametip()Returnsthissince this object is already a local name.Returns a local-dependent string representation of this local name.Returns a locale-independent string representation of this local name.Methods inherited from class AbstractNamecastOrCopy, hashCode, push, toFullyQualifiedNameMethods inherited from class Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface GenericNamepush, toFullyQualifiedName
- 
Constructor Details- 
DefaultLocalNameConstructs a local name from the given character sequence. If the character sequence is an instance ofInternationalString, then itstoString(Locale.ROOT)method will be invoked for fetching an unlocalized name. Otherwise theCharSequence.toString()method will be used.- Parameters:
- scope- the scope of this name, or- nullfor a global scope.
- name- the local name (never- null).
 
 
- 
- 
Method Details- 
castOrCopyReturns a SIS local 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 MemberNameorTypeName, then this method delegates tocastOrCopy(…)method of the corresponding subclass.
- Otherwise if the given object is already an instance of DefaultLocalName, then it is returned unchanged.
- Otherwise a new DefaultLocalNameinstance is created with the same values than the given name.
 - 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. This method returns a non-null value in all cases, even when the scope given to the constructor was null.- Specified by:
- scopein interface- GenericName
- Specified by:
- scopein class- AbstractName
- Returns:
- the scope of this name.
 
- 
depthpublic final int depth()Returns the depth, which is always 1 for a local name.- Specified by:
- depthin interface- GenericName
- Specified by:
- depthin interface- LocalName
- Overrides:
- depthin class- AbstractName
- Returns:
- the depth of this name.
 
- 
getParsedNamesReturns the sequence of local name for this name. Since this object is itself a local name, this method always returns a singleton containing onlythis.- Specified by:
- getParsedNamesin interface- GenericName
- Specified by:
- getParsedNamesin interface- LocalName
- Specified by:
- getParsedNamesin class- AbstractName
- Returns:
- the local names making this generic name, without the scope.
         Shall never be nullneither empty.
 
- 
headReturnsthissince this object is already a local name.- Specified by:
- headin interface- GenericName
- Specified by:
- headin interface- LocalName
- Overrides:
- headin class- AbstractName
- Returns:
- this.
 
- 
tipReturnsthissince this object is already a local name.- Specified by:
- tipin interface- GenericName
- Specified by:
- tipin interface- LocalName
- Overrides:
- tipin class- AbstractName
- Returns:
- this.
 
- 
toStringReturns a locale-independent string representation of this local name. This string does not include the scope, which is consistent with the parsed names definition.- Specified by:
- toStringin interface- GenericName
- Specified by:
- toStringin interface- LocalName
- Overrides:
- toStringin class- AbstractName
- Returns:
- a local-independent string representation of this name.
 
- 
toInternationalStringReturns a local-dependent string representation of this local name.- Specified by:
- toInternationalStringin interface- GenericName
- Overrides:
- toInternationalStringin class- AbstractName
- Returns:
- a localizable string representation of this name.
 
- 
compareToCompares this name with the specified object for order. Returns a negative integer, zero, or a positive integer as this name lexicographically precedes, is equal to, or follows the specified object.- Specified by:
- compareToin interface- Comparable<GenericName>
- Overrides:
- compareToin class- AbstractName
- 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.
 
- 
equalsCompares this local name with the specified object for equality.- Overrides:
- equalsin class- AbstractName
- Parameters:
- object- the object to compare with this name for equality.
- Returns:
- trueif the given object is equal to this name.
 
 
-