The Spring Framework

org.springframework.beans
Interface BeanWrapper

All Superinterfaces:
ConfigurablePropertyAccessor, PropertyAccessor, PropertyEditorRegistry
All Known Implementing Classes:
BeanWrapperImpl

public interface BeanWrapper
extends ConfigurablePropertyAccessor

The central interface of Spring's low-level JavaBeans infrastructure.

Typically not used directly but rather implicitly via a BeanFactory or a DataBinder.

Provides operations to analyze and manipulate standard Java Beans: the ability to get and set property values (individually or in bulk), get property descriptors, and query the readability/writability of properties.

This interface supports nested properties enabling the setting of properties on subproperties to an unlimited depth. A BeanWrapper instance can be used repeatedly, with its target object (the wrapped Java Bean instance) changing as required.

A BeanWrapper's default for the "extractOldValueForEditor" setting is "false", to avoid side effects caused by getter method invocations. Turn this to "true" to expose present property values to custom editors.

Since:
13 April 2001
Author:
Rod Johnson, Juergen Hoeller
See Also:
ConfigurablePropertyAccessor.setExtractOldValueForEditor(boolean), PropertyAccessor, PropertyEditorRegistry, BeanWrapperImpl, BeanFactory, BeanPropertyBindingResult, DataBinder.initBeanPropertyAccess()

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
 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 getWrappedClass()
          Convenience method to return the class of the wrapped object.
 Object getWrappedInstance()
          Return the bean wrapped by this object (cannot be null).
 void setWrappedInstance(Object obj)
          Change the wrapped object.
 
Methods inherited from interface org.springframework.beans.ConfigurablePropertyAccessor
isExtractOldValueForEditor, setExtractOldValueForEditor
 
Methods inherited from interface org.springframework.beans.PropertyAccessor
getPropertyType, getPropertyValue, isReadableProperty, isWritableProperty, setPropertyValue, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues
 
Methods inherited from interface org.springframework.beans.PropertyEditorRegistry
findCustomEditor, registerCustomEditor, registerCustomEditor
 

Method Detail

setWrappedInstance

void setWrappedInstance(Object obj)
Change the wrapped object. Implementations are required to allow the type of the wrapped object to change.

Parameters:
obj - wrapped object that we are manipulating

getWrappedInstance

Object getWrappedInstance()
Return the bean wrapped by this object (cannot be null).

Returns:
the bean wrapped by this object

getWrappedClass

Class getWrappedClass()
Convenience method to return the class of the wrapped object.

Returns:
the class of the wrapped object

getPropertyDescriptors

PropertyDescriptor[] getPropertyDescriptors()
                                            throws BeansException
Get the PropertyDescriptors identified on this object (standard JavaBeans introspection).

Returns:
the PropertyDescriptors identified on this object
Throws:
BeansException

getPropertyDescriptor

PropertyDescriptor getPropertyDescriptor(String propertyName)
                                         throws BeansException
Get the property descriptor for a particular property.

Parameters:
propertyName - property to check status for
Returns:
the property descriptor for the particular property
Throws:
InvalidPropertyException - if there is no such property
BeansException

The Spring Framework

Copyright © 2002-2006 The Spring Framework.