Modifier and Type | Method and Description |
---|---|
<T> T |
get(String key,
Class<T> type)
Retrieve the given model item, of the given type.
|
<T> T |
get(String key,
TypeToken<T> type)
Retrieve the given model item, of the given type.
|
Map<String,Object> |
map(String key) |
<K,V> Map<K,V> |
map(String key,
Class<K> keyType,
Class<V> valueType) |
<T> T get(String key, Class<T> type)
If there is no model item with the given key, null
is returned.
If the model item with the given key is assignment compatible with the given type it is returned.
If the model item is NOT assignment compatible with the given type, an IllegalArgumentException
will be thrown.
Note: generic types are completely ignored for assignment compatiblity, due to Java's type erasure.
T
- the target type of the model itemkey
- the model item keytype
- the target type of the model item<T> T get(String key, TypeToken<T> type)
If there is no model item with the given key, null
is returned.
If the model item with the given key is assignment compatible with the given type it is returned.
If the model item is NOT assignment compatible with the given type, an IllegalArgumentException
will be thrown.
Note: generic types are completely ignored for assignment compatiblity, due to Java's type erasure.
T
- the target type of the model itemkey
- the model item keytype
- the target type of the model item