T - the type of value this key should map to.
public static class ObservableProperties.Key<T> extends Objectimplements Serializable , Comparable <ObservableProperties .Key <?>>
Strings is that these objects have a parameterized type: so casting is not necessary.
You can technically have two keys with the same name and different types in the same property set.
It is recommended (but not necessary) that keys be stored as public static fields.
| Constructor and Description |
|---|
Key(String
Create a new Key.
|
Key(String
Create a new Key with a numeric
ObservableProperties.BoundsChecker.
|
Key(String
Create a new Key.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(ObservableProperties
|
boolean |
equals(Object
|
T |
get(Map
Retrieve this key from a map of values or return the default value provided if the key is not identified.
|
ObservableProperties |
getBoundsChecker()
|
String |
getKeyName()
Returns the original key name associated with this key.
|
Class |
getType()
|
int |
hashCode()
|
boolean |
matches(PropertyChangeEvent
|
String |
toString()
The key name property.
|
public Key(StringkeyName, Class <T> type)
keyName - the name of this key.
type - the parameterized type of this key. (Is there a way to ascertain this by reflection? Stating this here seems redundant, but necessary.)
public Key(StringkeyName, Class <T> type, ObservableProperties .BoundsChecker checker)
keyName - the name of this key.
type - the parameterized type of this key. (Is there a way to ascertain this by reflection? Stating this here seems redundant, but necessary.)
checker - an optional
ObservableProperties.BoundsChecker to throw an exception if someone attempts to assign a value that isn't allowed.
public Key(StringkeyName, Class <T> type, Number min, Number max, boolean includeMin, boolean includeMax)
ObservableProperties.BoundsChecker.
keyName - the name of this key.
type - the parameterized type of this key. (Is there a way to ascertain this by reflection? Stating this here seems redundant, but necessary.)
min - the minimum accepted value.
max - the maximum accepted value.
includeMin - if true then this applies a "greater than or equal to" check. If false then this simply applies a "greater than" check, so if someone tries to use a value that is exactly equal to the minimum: it will fail.
includeMax - if true then this applies a "less than or equal to" check. If false then this simply applies a "less than" check, so if someone tries to use a value that is exactly equal to the maximum: it will fail.
public T get(Map<String ,Object > map, T defaultValue)
Note the key name in the map does not have to be exact. For example if the map was generated via ObservableProperties then in might have text prepended or appended to the technical key name. As soon as a partial match is identified that matches this key name (that also is consistent with the type required by this Key): then that value is returned. For this reason: key names should err on the side of being more specific/thorough than not.
map - the map to check against.
defaultValue - the optional default value if the map doesn't contain the key.
public boolean matches(PropertyChangeEventevt)
evt - the evt to check against.
public ObservableProperties.BoundsChecker <T> getBoundsChecker()
public int hashCode()
public boolean equals(Objectt)
public StringgetKeyName()
public StringtoString()
public int compareTo(ObservableProperties.Key <?> o)