Package 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 ofAttributeAccessorSupport
, holding attributes asBeanMetadataAttribute
objects in order to keep track of the definition source.- Since:
- 2.5
- Author:
- Juergen Hoeller
- See Also:
- Serialized Form
Constructor Summary
Constructors Constructor Description BeanMetadataAttributeAccessor()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 byname
.BeanMetadataAttribute
getMetadataAttribute(String name)
Look up the given BeanMetadataAttribute in this accessor's set of attributes.Object
getSource()
Return the configuration sourceObject
for this metadata element (may benull
).Object
removeAttribute(String name)
Remove the attribute identified byname
and return its value.void
setAttribute(String name, Object value)
Set the attribute defined byname
to the suppliedvalue
.void
setSource(Object source)
Set the configuration sourceObject
for this metadata element.Methods inherited from class org.springframework.core.AttributeAccessorSupport
attributeNames, copyAttributesFrom, equals, hasAttribute, hashCode
Constructor Detail
BeanMetadataAttributeAccessor
public BeanMetadataAttributeAccessor()
Method Detail
setSource
public void setSource(Object source)
Set the configuration sourceObject
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 sourceObject
for this metadata element (may benull
).- Specified by:
getSource
in interfaceBeanMetadataElement
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 byname
to the suppliedvalue
. Ifvalue
isnull
, the attribute isremoved
.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 interfaceAttributeAccessor
- Overrides:
setAttribute
in classAttributeAccessorSupport
- Parameters:
name
- the unique attribute keyvalue
- the attribute value to be attached
getAttribute
public Object getAttribute(String name)
Description copied from interface:AttributeAccessor
Get the value of the attribute identified byname
. Returnnull
if the attribute doesn't exist.- Specified by:
getAttribute
in interfaceAttributeAccessor
- Overrides:
getAttribute
in classAttributeAccessorSupport
- 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 byname
and return its value. Returnnull
if no attribute undername
is found.- Specified by:
removeAttribute
in interfaceAttributeAccessor
- Overrides:
removeAttribute
in classAttributeAccessorSupport
- Parameters:
name
- the unique attribute key- Returns:
- the last value of the attribute, if any