The Spring Framework

## org.springframework.beans
Class BeanMetadataAttributeAccessor

    java.lang.Object
      org.springframework.core.AttributeAccessorSupport
          org.springframework.beans.BeanMetadataAttributeAccessor

All Implemented Interfaces:
  Serializable, BeanMetadataElement, AttributeAccessor

Direct Known Subclasses:
  AbstractBeanDefinition, AutowireCandidateQualifier, PropertyValue

    public class BeanMetadataAttributeAccessor

extends AttributeAccessorSupport
implements BeanMetadataElement

Extension of `AttributeAccessorSupport`, holding attributes as `BeanMetadataAttribute` objects in order to keep track of the definition source.

Since:
  2.5
Author:
  Juergen Hoeller
See Also:
  Serialized Form

Constructor Summary
`BeanMetadataAttributeAccessor()`

Method Summary
`void` `addMetadataAttribute(BeanMetadataAttribute attribute)` Add the given BeanMetadataAttribute to this accessor's set of attributes.
`Object` `getAttribute(String name)` Get the value of the attribute identified by `name`.
`BeanMetadataAttribute` `getMetadataAttribute(String name)` Look up the given BeanMetadataAttribute in this accessor's set of attributes.
`Object` `getSource()` Return the configuration source `Object` for this metadata element (may be `null`).
`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`.
`void` `setSource(Object source)` Set the configuration source `Object` for this metadata element.

Methods inherited from class org.springframework.core.AttributeAccessorSupport
`attributeNames, copyAttributesFrom, equals, hasAttribute, hashCode`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BeanMetadataAttributeAccessor

    public BeanMetadataAttributeAccessor()

Method Detail

### setSource

    public void setSource(Object source)

  Set the configuration source `Object` for this metadata element.

  The exact type of the object will depend on the configuration mechanism used.

### getSource

    public Object getSource()

  Description copied from interface: `BeanMetadataElement`
  Return the configuration source `Object` for this metadata element (may be `null`).

  Specified by:
    `getSource` in interface `BeanMetadataElement`

### addMetadataAttribute

    public void addMetadataAttribute(BeanMetadataAttribute attribute)

  Add the given BeanMetadataAttribute to this accessor's set of attributes.

  Parameters:
    `attribute` - the BeanMetadataAttribute object to register

### getMetadataAttribute

    public BeanMetadataAttribute getMetadataAttribute(String name)

  Look up the given BeanMetadataAttribute in this accessor's set of attributes.

  Parameters:
    `name` - the name of the attribute
  Returns:
    the corresponding BeanMetadataAttribute object, or `null` if no such attribute defined

### setAttribute

    public void setAttribute(String name,
                             Object value)

  Description copied from interface: `AttributeAccessor`
  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.

  Specified by:
    `setAttribute` in interface `AttributeAccessor`
  Overrides:
    `setAttribute` in class `AttributeAccessorSupport`
  Parameters:
    `name` - the unique attribute key
    `value` - the attribute value to be attached

### getAttribute

    public Object getAttribute(String name)

  Description copied from interface: `AttributeAccessor`
  Get the value of the attribute identified by `name`. Return `null` if the attribute doesn't exist.

  Specified by:
    `getAttribute` in interface `AttributeAccessor`
  Overrides:
    `getAttribute` in class `AttributeAccessorSupport`
  Parameters:
    `name` - the unique attribute key
  Returns:
    the current value of the attribute, if any

### removeAttribute

    public Object removeAttribute(String name)

  Description copied from interface: `AttributeAccessor`
  Remove the attribute identified by `name` and return its value. Return `null` if no attribute under `name` is found.

  Specified by:
    `removeAttribute` in interface `AttributeAccessor`
  Overrides:
    `removeAttribute` in class `AttributeAccessorSupport`
  Parameters:
    `name` - the unique attribute key
  Returns:
    the last value of the attribute, if any

The Spring Framework

Copyright © 2002-2008 The Spring Framework.