Package org.apache.sis.util.iso
Class DefaultNameSpace
Object
DefaultNameSpace
- All Implemented Interfaces:
- Serializable,- NameSpace
A domain in which names given by character strings are defined.
 This implementation does not support localization in order to avoid ambiguity when testing
 two namespaces for equality.
 
DefaultNameSpace can be instantiated by any of the following methods:
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 NameSpace state.- Since:
- 0.3
- See Also:
Defined in the sis-metadata module
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final charThe default separator, which is':'.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedDefaultNameSpace(DefaultNameSpace parent, CharSequence name, String headSeparator, String separator) Creates a new namespace with the given separator.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturnstrueif this namespace is equal to the given object.static StringgetSeparator(NameSpace ns, boolean head) Returns the separator between name components in the given namespace.intReturns a hash code value for this namespace.booleanIndicates whether this namespace is a "top level" namespace.name()Represents the identifier of this namespace.Returns a JCR-like lexical form representation of this namespace.
- 
Field Details- 
DEFAULT_SEPARATORpublic static final char DEFAULT_SEPARATORThe default separator, which is':'. The separator is inserted between the namespace and any generic name in that namespace.- See Also:
 
 
- 
- 
Constructor Details- 
DefaultNameSpaceprotected DefaultNameSpace(DefaultNameSpace parent, CharSequence name, String headSeparator, String separator) Creates a new namespace with the given separator.- Parameters:
- parent- the parent namespace, or- nullif none.
- name- the name of the new namespace, usually as a- Stringor an- InternationalString.
- headSeparator- the separator to insert between the namespace and the head of any name in that namespace.
- separator- the separator to insert between the parsed names of any name in that namespace.
 
 
- 
- 
Method Details- 
getSeparatorReturns the separator between name components in the given namespace. If the given namespace is an instance ofDefaultNameSpace, then this method returns theheadSeparatororseparatorargument given to the constructor. Otherwise this method returns the default separator.API note: this method is static because thegetSeparator(…)method is not part of GeoAPI interfaces. A static method makes easier to use without(if (x instanceof DefaultNameSpace)checks.- Parameters:
- ns- the namespace for which to get the separator. May be- null.
- head-- truefor the separator between namespace and head, or- falsefor the separator between parsed names.
- Returns:
- separator between name components.
- Since:
- 1.3
 
- 
isGlobalpublic boolean isGlobal()Indicates whether this namespace is a "top level" namespace. Global, or top-level namespaces are not contained within another namespace. The global namespace has no parent.- Specified by:
- isGlobalin interface- NameSpace
- Returns:
- trueif this namespace is the global namespace.
 
- 
nameRepresents the identifier of this namespace. Namespace identifiers shall be fully-qualified names where the following condition holds:assert name.scope().isGlobal() == true; - Specified by:
- namein interface- NameSpace
- Returns:
- the identifier of this namespace.
 
- 
toStringReturns a JCR-like lexical form representation of this namespace. Following the Java Content Repository (JCR) convention, this method returns the string representation of name() between curly brackets.Example: if the name of this namespace is “org.apache.sis”, then this method returns “{org.apache.sis}”.UsageWith this convention, it would be possible to create an expanded form of a generic name (except for escaping of illegal characters) with a simple concatenation as in the following code example:
 However, the convention followed by thisGenericName name = ...; // A name println("Expanded form = " + name.scope() + name);DefaultNameSpaceimplementation is not specified in theNameSpacecontract. This implementation follows the JCR convention for debugging convenience, but applications needing better guarantees should useNames.toExpandedString(GenericName)instead.
- 
equalsReturnstrueif this namespace is equal to the given object.
- 
hashCodepublic int hashCode()Returns a hash code value for this namespace.
 
-