|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The central interface of Spring's low-level JavaBeans infrastructure; the default implementation is BeanWrapperImpl. Typically not directly used by application code but rather implicitly via a BeanFactory or a DataBinder.
To be implemented by classes that can manipulate Java beans. Implementing classes have the ability to get and set property values (individually or in bulk), get property descriptors and query the readability and writability of properties.
This interface supports nested properties enabling the setting of properties on subproperties to an unlimited depth.
If a property update causes an exception, a PropertyVetoException will be thrown. Bulk updates continue after exceptions are encountered, throwing an exception wrapping all exceptions encountered during the update.
BeanWrapper implementations can be used repeatedly, with their "target" or wrapped object changed.
BeanWrapperImpl
,
BeanFactory
,
DataBinder
Field Summary |
Fields inherited from interface org.springframework.beans.PropertyAccessor |
NESTED_PROPERTY_SEPARATOR, NESTED_PROPERTY_SEPARATOR_CHAR, PROPERTY_KEY_PREFIX, PROPERTY_KEY_PREFIX_CHAR, PROPERTY_KEY_SUFFIX, PROPERTY_KEY_SUFFIX_CHAR |
Method Summary | |
PropertyEditor |
findCustomEditor(Class requiredType,
String propertyPath)
Find a custom property editor for the given type and property. |
PropertyDescriptor |
getPropertyDescriptor(String propertyName)
Get the property descriptor for a particular property. |
PropertyDescriptor[] |
getPropertyDescriptors()
Get the PropertyDescriptors identified on this object (standard JavaBeans introspection). |
Class |
getPropertyType(String propertyName)
Determine the property type for a particular property, either checking the property descriptor or checking the value in case of an indexed or mapped element. |
Class |
getWrappedClass()
Convenience method to return the class of the wrapped object. |
Object |
getWrappedInstance()
Return the bean wrapped by this object (cannot be null). |
boolean |
isReadableProperty(String propertyName)
Return whether this property is readable. |
boolean |
isWritableProperty(String propertyName)
Return whether this property is writable. |
void |
registerCustomEditor(Class requiredType,
PropertyEditor propertyEditor)
Register the given custom property editor for all properties of the given type. |
void |
registerCustomEditor(Class requiredType,
String propertyPath,
PropertyEditor propertyEditor)
Register the given custom property editor for the given type and property, or for all properties of the given type. |
void |
setWrappedInstance(Object obj)
Change the wrapped object. |
Methods inherited from interface org.springframework.beans.PropertyAccessor |
getPropertyValue, setPropertyValue, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues |
Method Detail |
public void setWrappedInstance(Object obj)
obj
- wrapped object that we are manipulatingpublic Object getWrappedInstance()
public Class getWrappedClass()
public void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor)
requiredType
- type of the propertypropertyEditor
- editor to registerpublic void registerCustomEditor(Class requiredType, String propertyPath, PropertyEditor propertyEditor)
If the property path denotes an array or Collection property, the editor will get applied either to the array/Collection itself (the PropertyEditor has to create an array or Collection value) or to each element (the PropertyEditor has to create the element type), depending on the specified required type.
Note: Only one single registered custom editor per property path is supported. In case of a Collection/array, do not register an editor for both the Collection/array and each element on the same property.
requiredType
- type of the property (can be null if a property is
given but should be specified in any case for consistency checking)propertyPath
- path of the property (name or nested path), or
null if registering an editor for all properties of the given typepropertyEditor
- editor to registerpublic PropertyEditor findCustomEditor(Class requiredType, String propertyPath)
requiredType
- type of the property (can be null if a property is
given but should be specified in any case for consistency checking)propertyPath
- path of the property (name or nested path), or
null if looking for an editor for all properties of the given type
public PropertyDescriptor[] getPropertyDescriptors() throws BeansException
BeansException
public PropertyDescriptor getPropertyDescriptor(String propertyName) throws BeansException
propertyName
- property to check status for
InvalidPropertyException
- if there is no such property
BeansException
public Class getPropertyType(String propertyName) throws BeansException
propertyName
- property to check status for
InvalidPropertyException
- if there is no such property
BeansException
public boolean isReadableProperty(String propertyName) throws BeansException
propertyName
- property to check status for
BeansException
public boolean isWritableProperty(String propertyName) throws BeansException
propertyName
- property to check status for
BeansException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |