org.jhotdraw.draw
Class AttributeKey<T>
java.lang.Object
org.jhotdraw.draw.AttributeKey<T>
public class AttributeKey<T>
- extends java.lang.Object
Provides typesafe getter and setter for a Figure attribute.
An AttributeKey has a name, a type and a default value. The default value
is returned by Figure.getAttribute, if a Figure does not have an attribute
of the specified key.
|
Constructor Summary |
AttributeKey(java.lang.String key)
Creates a new instance. |
AttributeKey(java.lang.String key,
T defaultValue)
|
AttributeKey(java.lang.String key,
T defaultValue,
boolean isNullValueAllowed)
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
AttributeKey
public AttributeKey(java.lang.String key)
- Creates a new instance.
AttributeKey
public AttributeKey(java.lang.String key,
T defaultValue)
AttributeKey
public AttributeKey(java.lang.String key,
T defaultValue,
boolean isNullValueAllowed)
getKey
public java.lang.String getKey()
getDefaultValue
public T getDefaultValue()
get
public T get(Figure f)
set
public void set(Figure f,
T value)
basicSet
public void basicSet(Figure f,
T value)
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
isNullValueAllowed
public boolean isNullValueAllowed()
main
public static void main(java.lang.String[] args)
isAssignable
public boolean isAssignable(java.lang.Object value)