|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.core.AttributeAccessorSupport
public abstract class AttributeAccessorSupport
Support class for AttributeAccessors
, providing
a base implementation of all methods. To be extended by subclasses.
Serializable
if subclasses and all attribute values are Serializable
.
Field Summary | |
---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
attributes
Map with String keys and Object values |
Constructor Summary | |
---|---|
AttributeAccessorSupport()
|
Method Summary | |
---|---|
java.lang.String[] |
attributeNames()
Return the names of all attributes. |
protected void |
copyAttributesFrom(AttributeAccessor source)
Copy the attributes from the supplied AttributeAccessor to this accessor. |
boolean |
equals(java.lang.Object other)
|
java.lang.Object |
getAttribute(java.lang.String name)
Get the value of the attribute identified by name . |
boolean |
hasAttribute(java.lang.String name)
Return true if the attribute identified by name exists. |
int |
hashCode()
|
java.lang.Object |
removeAttribute(java.lang.String name)
Remove the attribute identified by name and return its value. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set the attribute defined by name to the supplied value . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.util.Map<java.lang.String,java.lang.Object> attributes
Constructor Detail |
---|
public AttributeAccessorSupport()
Method Detail |
---|
public void setAttribute(java.lang.String name, java.lang.Object value)
AttributeAccessor
name
to the supplied value
.
If value
is null
, the attribute is removed
.
In general, users should take care to prevent overlaps with other metadata attributes by using fully-qualified names, perhaps using class or package names as prefix.
setAttribute
in interface AttributeAccessor
name
- the unique attribute keyvalue
- the attribute value to be attachedpublic java.lang.Object getAttribute(java.lang.String name)
AttributeAccessor
name
.
Return null
if the attribute doesn't exist.
getAttribute
in interface AttributeAccessor
name
- the unique attribute key
public java.lang.Object removeAttribute(java.lang.String name)
AttributeAccessor
name
and return its value.
Return null
if no attribute under name
is found.
removeAttribute
in interface AttributeAccessor
name
- the unique attribute key
public boolean hasAttribute(java.lang.String name)
AttributeAccessor
true
if the attribute identified by name
exists.
Otherwise return false
.
hasAttribute
in interface AttributeAccessor
name
- the unique attribute keypublic java.lang.String[] attributeNames()
AttributeAccessor
attributeNames
in interface AttributeAccessor
protected void copyAttributesFrom(AttributeAccessor source)
source
- the AttributeAccessor to copy frompublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |