org.inria.ns.reflex.util
Class Key

java.lang.Object
  extended by org.inria.ns.reflex.util.Key
Direct Known Subclasses:
CatalogKey

public class Key
extends Object

A key used to store typed and named resources in a registry. Any type used in a key, must be also used as the name in another key which type is a factory.


Field Summary
 int hash
          The hash code of this key.
 Object name
          The name of the resource (QName or String).
 QName type
          The type of the resource.
 
Constructor Summary
Key(QName type, QName name)
          Create a new key.
Key(QName type, String name)
          Create a new key.
 
Method Summary
 boolean equals(Object obj)
          Compare two keys.
 int hashCode()
          Return the hash code of this key.
 String toString()
          Return the name of this key.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

type

public QName type
The type of the resource.


name

public Object name
The name of the resource (QName or String).


hash

public int hash
The hash code of this key.

Constructor Detail

Key

public Key(QName type,
           String name)
Create a new key.

Parameters:
type - The type of object to retrieve with this key.
name - The name of the resource.

Key

public Key(QName type,
           QName name)
Create a new key.

Parameters:
type - The type of object to retrieve with this key.
name - The name of the resource.
Method Detail

hashCode

public int hashCode()
Return the hash code of this key.

Overrides:
hashCode in class Object
Returns:
The hash code of this key.
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Compare two keys.

Overrides:
equals in class Object
Parameters:
obj - The object to compare with this key.
Returns:
true if the object to compare is a key with the same type and same name as this object, false otherwise.
See Also:
Object.equals(java.lang.Object)

toString

public String toString()
Return the name of this key.

Overrides:
toString in class Object
Returns:
The name of this key, as a string.
See Also:
Object.toString()