public class Attributes extends Object implements Serializable
Attributes class represents a set of attributes.| Constructor and Description |
|---|
Attributes() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getAttribute(Class<T> type)
Gets a stored attribute value.
|
Object |
getAttribute(String name)
Gets a stored attribute value.
|
boolean |
isEmpty()
Returns
true if there are no attributes. |
<T> void |
setAttribute(Class<T> type,
T value)
Stores a value in this set.
|
void |
setAttribute(String name,
Object value)
Stores a value in this set.
|
public void setAttribute(String name, Object value)
name - the name to associate the value with, can not be
nullvalue - the value to associate with the name, or null to
remove a previous association.getAttribute(String)public <T> void setAttribute(Class<T> type, T value)
null clears
the stored value.
The fully qualified name of the type is used as the name when storing the value. The outcome of calling this method is thus the same as if calling
setAttribute(type.getName(), value);
T - the attribute typetype - the type that the stored value represents, can not be nullvalue - the value to associate with the type, or null to
remove a previous association.getAttribute(Class),
setAttribute(String, Object)public Object getAttribute(String name)
null is returned.name - the name of the value to get, can not be null.null if no value has been stored or if
it has been set to null.setAttribute(String, Object)public <T> T getAttribute(Class<T> type)
null is returned.
The fully qualified name of the type is used as the name when getting the
value. The outcome of calling this method is thus the same as if calling
getAttribute(type.getName());
T - the attribute typetype - the type of the value to get, can not be null.null if no value has been stored or if
it has been set to null.setAttribute(Class, Object),
getAttribute(String)public boolean isEmpty()
true if there are no attributes.true if there are no attributesCopyright © 2025. All rights reserved.