public final class QualifiedName extends Object
SEPARATOR
).
A qualified name is in the scope of its own namespace and all children
namespaces of its own namespace (i.e. the namespaces "deeper down"
the hierarchy). For example, the namespace org.apache.torque
is in the scope of org.apache but not in the scope of
org.apache.torque.generator.
As a special case, if the namespace is the empty String,
the name is valid in all namespaces.
The namespace and the name are also separated by a dot
(SEPARATOR
).
Instances of this class are immutable. To prevent mutable subclasses,
this class is final.Modifier and Type | Field and Description |
---|---|
static char |
SEPARATOR
The separator between namespace parts and between namespacee
and local name in the string representation of a QualifiedName.
|
Constructor and Description |
---|
QualifiedName(String qualifiedName)
Creates a QualifiedName from its string representation, which is
namespace:name.
|
QualifiedName(String nameOrQualifiedName,
Namespace defaultNamespace)
Creates a QualifiedName from a fully qualified name or the name and the
namespace parts of a QualifiedName.
|
QualifiedName(String nameOrQualifiedName,
String defaultNamespace)
Creates a QualifiedName from a fully qualified name or the name and the
namespace parts of a QualifiedName.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Returns if this object equals another object.
|
String |
getName()
Returns the name part of the QualifiedName.
|
Namespace |
getNamespace()
Returns the namespace of the QualifiedName.
|
Namespace |
getParentNamespace()
Returns the parent of the Qualified name's namespace.
|
int |
hashCode()
Returns a hashcode for the QualifiedName.
|
boolean |
isInRootNamespace()
Returns if the namespace of this qualified name is the root namespace.
|
boolean |
isVisibleFrom(Namespace otherNamespace)
Returns if this qualified name is visible from another namespace.
|
String |
toString()
Returns the String representation of the QualifiedName,
which is namespace.name if namespace is not empty,
or name if namespace is empty.
|
public static final char SEPARATOR
public QualifiedName(String qualifiedName)
qualifiedName
- the string representation of the QualifiedName,
must contain a non-empty name part.NullPointerException
- if qualifiedName is nullpublic QualifiedName(String nameOrQualifiedName, String defaultNamespace)
nameOrQualifiedName
- either the name part of the QualifiedName,
or a fully qualified name. May not be null and must contain
an non-empty name part.defaultNamespace
- the namespace of the QualifiedName,
may be null if nameOrQualifiedName has a namespace part.IllegalArgumentException
- if name has an empty name part, or
if no namespace is found (nameOrQualifiedName has no namespace
part and defaultNamespace is null)NullPointerException
- if name is null.public QualifiedName(String nameOrQualifiedName, Namespace defaultNamespace)
nameOrQualifiedName
- either the name part of the QualifiedName,
or a fully qualified name. May not be null and must contain
an non-empty name part.defaultNamespace
- the namespace of the QualifiedName,
may be null if nameOrQualifiedName has a namespace part.IllegalArgumentException
- if name has an empty name part, or
if no namespace is found (nameOrQualifiedName has no namespace
part and defaultNamespace is null)NullPointerException
- if name is null.public String getName()
public Namespace getNamespace()
public boolean isVisibleFrom(Namespace otherNamespace)
otherNamespace
- the namespace against this QualifiedName
should be checked, not null.NullPointerException
- if otherNamespace is null.public Namespace getParentNamespace()
Namespace.getParent()
public boolean isInRootNamespace()
public String toString()
public boolean equals(Object o)
equals
in class Object
o
- the other object to compare this object to.Object.equals(Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.