Class NameImpl
- All Implemented Interfaces:
Serializable
,Comparable<NameImpl>
,Name
- Direct Known Subclasses:
AppSchemaDataAccessConfigurator.ComplexNameImpl
This class emulates QName, and is used as the implementation of both AttributeName and TypeName (so when the API settles down we should have a quick fix.
Its is advantageous to us to be able to:
- Have a API in agreement with QName - considering our target audience
- Strongly type AttributeName and TypeName separately
It case it is not obvious this is a value object and equality is based on namespace and name.
- Author:
- Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an instance with the local part set.Constructs an instance with the local part and namespace set.Constructs an instance with the local part and namespace set.Constract an instance from the provided QName. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
value object with equality based on name and namespace.Retrieve the "local" name.Returns the URI of the namespace for this name.Separator to use between getNamespaceURI() and getLocalPart() when constructing getURI().getURI()
Convert this name to a complete URI.int
hashCode()
Returns a hash code value for this operand.boolean
isGlobal()
Returnstrue
if getNamespaceURI isnull
toString()
name or namespace:name
-
Field Details
-
namespace
namespace / scope -
local
local part
-
-
Constructor Details
-
NameImpl
Constructs an instance with the local part set. Namespace / scope is set to null.- Parameters:
local
- The local part of the name.
-
NameImpl
Constructs an instance with the local part and namespace set.- Parameters:
namespace
- The namespace or scope of the name.local
- The local part of the name.
-
NameImpl
Constructs an instance with the local part and namespace set.- Parameters:
namespace
- The namespace or scope of the name.local
- The local part of the name.
-
NameImpl
Constract an instance from the provided QName.
-
-
Method Details
-
isGlobal
public boolean isGlobal()Description copied from interface:Name
Returnstrue
if getNamespaceURI isnull
-
getSeparator
Description copied from interface:Name
Separator to use between getNamespaceURI() and getLocalPart() when constructing getURI().This separator is only used to construct a visually pleasing getURI() result. The value to use as a separator depends on the registry or namespace you are working with. JNDI naming services have been known to use "/" and ":". Referring to an element in an XMLSchema document has been represented with a "#" symbol.
- Specified by:
getSeparator
in interfaceName
- Returns:
- A separator (such as "/" or ":").
-
getNamespaceURI
Description copied from interface:Name
Returns the URI of the namespace for this name.In ISO 19103 this is known as scope and containes a backpointer to the containing namespace. This solution is too heavy for our purposes, and we expect applications to provide their own lookup mechanism through which they can use this URI. The namespace URI does serve to make this name unique and is checked as part of the equals operation.
- Specified by:
getNamespaceURI
in interfaceName
-
getLocalPart
Description copied from interface:Name
Retrieve the "local" name.This mechanism captures the following ISO 19103 concerns:
- GenericName.depth(): this concept is not interesting, we assume a namespace would be able to navigate through contained namespace on its own based on this local part.
- GenericName.asLocalName()
- GenericName.name()
- Specified by:
getLocalPart
in interfaceName
- Returns:
- local name (can be used in namespace lookup)
-
getURI
Description copied from interface:Name
Convert this name to a complete URI.This URI is constructed with the getNamespaceURI(), getSeparator() and getLocalPart().
This method captures the following concerns of ISO 19103 concerns:
- GenericName.getParsedNames()
- toFullyQuantifiedName()
As an example:
- namespace: "gopher://localhost/example" separator: "/" local: "name"
- namespace: "gopher://localhost" separator: "/" local: "example/name"
-
hashCode
public int hashCode()Returns a hash code value for this operand. -
equals
value object with equality based on name and namespace. -
toString
name or namespace:name -
compareTo
- Specified by:
compareTo
in interfaceComparable<NameImpl>
-