com.bea.wlai.common
Class QualifiedName

java.lang.Object
  extended by com.bea.wlai.common.QualifiedName
All Implemented Interfaces:
Serializable

public class QualifiedName
extends Object
implements Serializable

Represents a qualified name including a namespace and the object's name. For example, an object with name bar existing in a namespace with name foo would have a qualified name 'foo.bar'. This class is Serializable.

See Also:
Serialized Form

Constructor Summary
QualifiedName(INamespace namespace, String name)
          Construct a new QualifiedName with the given namespace and object name.
 
Method Summary
 boolean equals(Object obj)
          Compare this object to the given object and determine if they are equal.
 Iterator getComponents()
          Get an Iterator over the components of this qualified name.
 String getName()
          Return the object name portion of this QualifiedName.
 INamespace getNamespace()
          Return the namespace portion of this QualifiedName.
 int hashCode()
          Return a hash used to store QualifiedNames into hash tables, and retrieve them.
 void setName(String name)
          Set the name portion of this QualifiedName.
 void setNamespace(INamespace namespace)
          Set the namespace portion of this QualifiedName.
 String toString()
          Return a string representation of this QualifiedName.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QualifiedName

public QualifiedName(INamespace namespace,
                     String name)
              throws IllegalArgumentException
Construct a new QualifiedName with the given namespace and object name.

Parameters:
namespace - The namespace portion of this QualifiedName, or null if there is to be no namespace.
name - The object name portion of this QualifiedName. Null is not allowed.
Throws:
IllegalArgumentException - If the name parameter is null.
Method Detail

getNamespace

public INamespace getNamespace()
Return the namespace portion of this QualifiedName.

Returns:
The namespace portion of this QualifiedName, or null if none has been set.

setNamespace

public void setNamespace(INamespace namespace)
Set the namespace portion of this QualifiedName.

Parameters:
namespace - The new namespace, or null if there is to be no namespace.

getName

public String getName()
Return the object name portion of this QualifiedName.

Returns:
The object name portion of this QualifiedName. This should never be null.

setName

public void setName(String name)
             throws IllegalArgumentException
Set the name portion of this QualifiedName.

Parameters:
name - The new object name. Null is not allowed.
Throws:
IllegalArgumentException - If the new name is null.

getComponents

public Iterator getComponents()
Get an Iterator over the components of this qualified name. Each component is returned as a QualifiedName, starting with the first component that is not the root namespace. For example, if a namespace with name foo existing in the root namespace, and foo contained an object named bar, the getComponents method would return an Iterator over two components. This first component is a QualifiedName with namespace equal to the root namespace and name equal 'foo'. The second component is a QualifiedName with namespace equal to foo and name equal 'bar'.

Returns:
An iterator over the components (QualifiedName) of this qualified name.

toString

public String toString()
Return a string representation of this QualifiedName. Its returned in namespace.name format.

Overrides:
toString in class Object
Returns:
The string representation of this object.

equals

public boolean equals(Object obj)
Compare this object to the given object and determine if they are equal. For QualifiedNames, this means that both the namespace and name must be equal.

Overrides:
equals in class Object
Returns:
True if the name and namespace of the obj param equal this QualifiedName's name and namespace.

hashCode

public int hashCode()
Return a hash used to store QualifiedNames into hash tables, and retrieve them.

Overrides:
hashCode in class Object
Returns:
A hash value representing the toString() value for this object.