public abstract class

AttributeAccessorSupport

extends Object
implements Serializable AttributeAccessor
java.lang.Object
   ↳ org.springframework.core.AttributeAccessorSupport
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

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.

Summary

Public Constructors
AttributeAccessorSupport()
Public Methods
String[] attributeNames()
Return the names of all attributes.
boolean equals(Object other)
Object getAttribute(String name)
Get the value of the attribute identified by name.
boolean hasAttribute(String name)
Return true if the attribute identified by name exists.
int hashCode()
Object removeAttribute(String name)
Remove the attribute identified by name and return its value.
void setAttribute(String name, Object value)
Set the attribute defined by name to the supplied value.
Protected Methods
void copyAttributesFrom(AttributeAccessor source)
Copy the attributes from the supplied AttributeAccessor to this accessor.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.core.AttributeAccessor

Public Constructors

public AttributeAccessorSupport ()

Also: SpringCore

Public Methods

public String[] attributeNames ()

Also: SpringCore

Return the names of all attributes.

public boolean equals (Object other)

public Object getAttribute (String name)

Also: SpringCore

Get the value of the attribute identified by name. Return null if the attribute doesn't exist.

Parameters
name the unique attribute key
Returns
  • the current value of the attribute, if any

public boolean hasAttribute (String name)

Also: SpringCore

Return true if the attribute identified by name exists. Otherwise return false.

Parameters
name the unique attribute key

public int hashCode ()

public Object removeAttribute (String name)

Also: SpringCore

Remove the attribute identified by name and return its value. Return null if no attribute under name is found.

Parameters
name the unique attribute key
Returns
  • the last value of the attribute, if any

public void setAttribute (String name, Object value)

Also: SpringCore

Set the attribute defined by 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.

Parameters
name the unique attribute key
value the attribute value to be attached

Protected Methods

protected void copyAttributesFrom (AttributeAccessor source)

Also: SpringCore

Copy the attributes from the supplied AttributeAccessor to this accessor.

Parameters
source the AttributeAccessor to copy from