Klasse QualifiedName
java.lang.Object
org.apache.torque.generator.qname.QualifiedName
This class contains a name which has a namespace. The namespace defines the
scope where the name is valid, and is made up of hierarchical bits
separated by a dot (
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.-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final char
The separator between namespace parts and between namespacee and local name in the string representation of a QualifiedName. -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungQualifiedName
(String qualifiedName) Creates a QualifiedName from its string representation, which is namespace:name.QualifiedName
(String nameOrQualifiedName, String defaultNamespace) Creates a QualifiedName from a fully qualified name or the name and the namespace parts of a QualifiedName.QualifiedName
(String nameOrQualifiedName, Namespace defaultNamespace) Creates a QualifiedName from a fully qualified name or the name and the namespace parts of a QualifiedName. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
Returns if this object equals another object.getName()
Returns the name part of the QualifiedName.Returns the namespace of the QualifiedName.Returns the parent of the Qualified name's namespace.int
hashCode()
Returns a hashcode for the QualifiedName.boolean
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.toString()
Returns the String representation of the QualifiedName, which is namespace.name if namespace is not empty, or name if namespace is empty.
-
Felddetails
-
SEPARATOR
public static final char SEPARATORThe separator between namespace parts and between namespacee and local name in the string representation of a QualifiedName.- Siehe auch:
-
-
Konstruktordetails
-
QualifiedName
Creates a QualifiedName from its string representation, which is namespace:name. The namespace part may be empty (in which case the default namespace is used), but not the name part.- Parameter:
qualifiedName
- the string representation of the QualifiedName, must contain a non-empty name part.- Löst aus:
NullPointerException
- if qualifiedName is null
-
QualifiedName
Creates a QualifiedName from a fully qualified name or the name and the namespace parts of a QualifiedName.- Parameter:
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.- Löst aus:
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.
-
QualifiedName
Creates a QualifiedName from a fully qualified name or the name and the namespace parts of a QualifiedName.- Parameter:
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.- Löst aus:
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.
-
-
Methodendetails
-
getName
Returns the name part of the QualifiedName.- Gibt zurück:
- the name part of the QualifiedName, never null.
-
getNamespace
Returns the namespace of the QualifiedName.- Gibt zurück:
- the namespace of the QualifiedName, may be null.
-
isVisibleFrom
Returns if this qualified name is visible from another namespace. This is true if the namespace is a "child" of this qualified name's namespace. Note that for being a child, all the parts of the namespace separated by a dot must be equal. For example, "org.apache.torque:name" is visible from the namespaces "org.apache.torque.generator" and "org.apache.torque", but not from "org.apache"- Parameter:
otherNamespace
- the namespace against this QualifiedName should be checked, not null.- Gibt zurück:
- true if this QualifiedName is visible from the given namespace, false otherwise.
- Löst aus:
NullPointerException
- if otherNamespace is null.
-
getParentNamespace
Returns the parent of the Qualified name's namespace. If this qualified name is in the root namespace, the root namespace is returned.- Gibt zurück:
- the parent namespace of the qualified name's namespace, never null.
- Siehe auch:
-
isInRootNamespace
public boolean isInRootNamespace()Returns if the namespace of this qualified name is the root namespace.- Gibt zurück:
- true if the namespace is the root namespace, false otherwise.
-
toString
Returns the String representation of the QualifiedName, which is namespace.name if namespace is not empty, or name if namespace is empty. -
equals
Returns if this object equals another object. This is the case if the other object is also a QualifiedName and its name and namespace are the same as this object's name and namespace. -
hashCode
public int hashCode()Returns a hashcode for the QualifiedName. The hashcode is consistent with equals.
-