public class Attributes extends HashMap<String,String> implements Serializable
String property converted into a
specific type. The get(Key), put(Key, Object) and remove(Key) methods converts String
values to/from the instances of the class specified by Attributes.Key.type.| Modifier and Type | Class and Description |
|---|---|
static class |
Attributes.Key<T> |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
Attributes()
Creates a new attributes instance with no attributes
|
Attributes(Map<String,String> values)
Creates a new attributes instance and adds all attributes from the specified map
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(Attributes.Key<T> key)
Returns the value to the which the specified key name is mapped.
|
static <T> Attributes.Key<T> |
key(String name,
Class<T> type)
Creates a key with the specified name and type.
|
<T> T |
put(Attributes.Key<T> key,
T value)
Converts the value into a String using the
toString method |
<T> T |
remove(Attributes.Key<T> key)
Removes the attribute that is mapped to the specified key name
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, valuesequals, hashCode, toStringpublic Attributes()
public <T> T get(Attributes.Key<T> key)
key - the key for the attributeIllegalArgumentException - if the specified key is null, or the value failed to convert into to key typepublic <T> T put(Attributes.Key<T> key, T value)
toString methodkey - the key for the attributevalue - the valueIllegalArgumentException - if the specified key is null, the current value is non-null and failed to convert
into the key type, or the value class is not the same as the key typepublic <T> T remove(Attributes.Key<T> key)
key - the key for the the attributeIllegalArgumentException - if the specified key is null, or the current value is non-null and failed to to convert
into the key typepublic static <T> Attributes.Key<T> key(String name, Class<T> type)
String or implement a static
method valueOf(String) method as specified in get(Key). The valueOf method
should convert the string parameter into an instance of type and return it.name - the key nametype - the key typeIllegalArgumentException - if name or type is null, or if type is not String or does not implement the
static valueOf methodCopyright © 2013 JBoss by Red Hat. All Rights Reserved.