|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.generator.qname.Namespace
public final class Namespace
An instance of this class represents a hierarchical namespace. The hierarchy parts are separated by dots. A namespace is in another namespace if it starts with all the components of the the other namespace (it may contain other components afterwards). For example, the namespace "org.apache.torque" is in the namespace "org.apache". Note that the components and their order need to be equal, it does not suffice if a namespace starts with another namespace. For example, the namespace "org.apache.torque" is not in the namespace "org.ap". Instances of this class are immutable. To guard against mutable subclasses, this class is final.
Field Summary | |
---|---|
static Namespace |
ROOT_NAMESPACE
The root namespace. |
static char |
SEPARATOR
The separator between the hierachical parts of a namespace. |
Constructor Summary | |
---|---|
Namespace(List<String> namespaceParts)
Creates a namespace from a hierarchical List of namespace parts. |
|
Namespace(Namespace toCopy)
Copy-Contructor. |
|
Namespace(String namespace)
Constructs a namespace from its string representation. |
Method Summary | |
---|---|
boolean |
equals(Object o)
Returns if this object is equal to another object. |
Namespace |
getParent()
Returns the parent of the given namespace. |
List<String> |
getParts()
Returns the parts of the namespace in hierachical order. |
int |
hashCode()
Returns a hash code for this namespace. |
boolean |
isRoot()
Returns whether this namespace is the root namespace. |
boolean |
isVisibleFrom(Namespace otherNamespace)
Returns if this namespace is visible from another namespace. |
boolean |
isVisibleTo(Namespace otherNamespace)
Returns if this namespace is visible to another namespace. |
String |
toString()
Returns a String representation of this namespace. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char SEPARATOR
public static final Namespace ROOT_NAMESPACE
Constructor Detail |
---|
public Namespace(String namespace)
namespace
- teh string representation of the namespace.
May not be null, and may not contain colons(:).
NullPointerException
- if namespace is null.
IllegalArgumentException
- if namespace contains colons.public Namespace(Namespace toCopy)
toCopy
- the namespace to copy, not null.
NullPointerException
- if toCopy is null.public Namespace(List<String> namespaceParts)
namespaceParts
- the parts of the namespace.Method Detail |
---|
public List<String> getParts()
public Namespace getParent()
public boolean isVisibleTo(Namespace otherNamespace)
otherNamespace
- the namespace against this namespace
should be checked, not null.
NullPointerException
- if otherNamespace is null.public boolean isVisibleFrom(Namespace otherNamespace)
otherNamespace
- the namespace against this namespace
should be checked, not null.
NullPointerException
- if otherNamespace is null.public boolean isRoot()
public boolean equals(Object o)
equals
in class Object
o
- the object to check equality.
Object.equals(Object)
public int hashCode()
equals()
.
hashCode
in class Object
Object.hashCode()
public String toString()
toString
in class Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |