|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javasimon.AttributesSupport
final class AttributesSupport
Attributes implementation that creates attributes map lazily. Is synchronized to ensure thread-safety.
| Field Summary | |
|---|---|
private Map<String,Object> |
attributes
|
| Constructor Summary | |
|---|---|
AttributesSupport()
|
|
| Method Summary | ||
|---|---|---|
Object |
getAttribute(String name)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists. |
|
|
getAttribute(String name,
Class<T> clazz)
Returns the value of the named attribute typed to the specified class, or null if no attribute of
the given name exists. |
|
Iterator<String> |
getAttributeNames()
Returns an Iterator containing the names of the attributes available to this Simon. |
|
Map<String,Object> |
getCopyAsSortedMap()
Returns copy of attributes as a sorted map, this can be used further for operations like toString. |
|
void |
removeAttribute(String name)
Removes an attribute from this Simon. |
|
void |
setAttribute(String name,
Object value)
Stores an attribute in this Simon. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Map<String,Object> attributes
| Constructor Detail |
|---|
AttributesSupport()
| Method Detail |
|---|
public void setAttribute(String name,
Object value)
HasAttributes
setAttribute in interface HasAttributesname - a String specifying the name of the attributevalue - the Object to be storedpublic Object getAttribute(String name)
HasAttributes
getAttribute in interface HasAttributesname - a String specifying the name of the attribute
public <T> T getAttribute(String name,
Class<T> clazz)
HasAttributesnull if no attribute of
the given name exists.
getAttribute in interface HasAttributesname - a String specifying the name of the attribute
null if the attribute does not existpublic void removeAttribute(String name)
HasAttributes
removeAttribute in interface HasAttributesname - a String specifying the name of the attribute to removepublic Iterator<String> getAttributeNames()
HasAttributes
getAttributeNames in interface HasAttributespublic Map<String,Object> getCopyAsSortedMap()
HasAttributestoString.
getCopyAsSortedMap in interface HasAttributes
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||