Also: SpringCore
public interface

AttributeAccessor

org.springframework.core.AttributeAccessor
Known Indirect Subclasses

Class Overview

Interface defining a generic contract for attaching and accessing metadata to/from arbitrary objects.

Summary

Public Methods
abstract String[] attributeNames()
Return the names of all attributes.
abstract Object getAttribute(String name)
Get the value of the attribute identified by name.
abstract boolean hasAttribute(String name)
Return true if the attribute identified by name exists.
abstract Object removeAttribute(String name)
Remove the attribute identified by name and return its value.
abstract void setAttribute(String name, Object value)
Set the attribute defined by name to the supplied value.

Public Methods

public abstract String[] attributeNames ()

Also: SpringCore

Return the names of all attributes.

public abstract 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 abstract 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 abstract 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 abstract 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