T
- Type of the object returned by the Value identified by this Key.public class Key<T>
extends java.lang.Object
Constructor and Description |
---|
Key(java.lang.Class<T> type,
java.lang.String keyName)
Create a new key.
|
Key(Type<T> type,
java.lang.String keyName) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getKeyName()
Get the name (identifier) of the Key.
|
Type<T> |
getType()
Get the type of the key.
|
int |
hashCode() |
T |
typeCast(java.lang.Object object)
Cast an object to the type of the key.
|
public Key(java.lang.Class<T> type, java.lang.String keyName)
Example usage:
Key<String> key = new Key(String.class, "identifier");
(In Keys class) public static final Key<String> IDENTIFIER = new Key(String.class, "identifier");
Key<String> key = Keys.IDENTIFIER;
type
- Class with type of the Object returned by the Value identified by this Key.keyName
- Name (identifier) of the Key.public java.lang.String getKeyName()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public T typeCast(java.lang.Object object)
object
- Object to cast.