public interface

BeanWrapper

implements ConfigurablePropertyAccessor
org.springframework.beans.BeanWrapper
Known Indirect Subclasses

Class Overview

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 JavaBeans: 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'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.

Summary

[Expand]
Inherited Constants
From interface org.springframework.beans.PropertyAccessor
Public Methods
abstract PropertyDescriptor getPropertyDescriptor(String propertyName)
Obtain the property descriptor for a specific property of the wrapped object.
abstract PropertyDescriptor[] getPropertyDescriptors()
Obtain the PropertyDescriptors for the wrapped object (as determined by standard JavaBeans introspection).
abstract Class getWrappedClass()
Return the type of the wrapped JavaBean object.
abstract Object getWrappedInstance()
Return the bean instance wrapped by this object, if any.
abstract boolean isAutoGrowNestedPaths()
Return whether "auto-growing" of nested paths has been activated.
abstract void setAutoGrowNestedPaths(boolean autoGrowNestedPaths)
Set whether this BeanWrapper should attempt to "auto-grow" a nested path that contains a null value.
[Expand]
Inherited Methods
From interface org.springframework.beans.ConfigurablePropertyAccessor
From interface org.springframework.beans.PropertyAccessor
From interface org.springframework.beans.PropertyEditorRegistry
From interface org.springframework.beans.TypeConverter

Public Methods

public abstract PropertyDescriptor getPropertyDescriptor (String propertyName)

Also: SpringBeans

Obtain the property descriptor for a specific property of the wrapped object.

Parameters
propertyName the property to obtain the descriptor for (may be a nested path, but no indexed/mapped property)
Returns
  • the property descriptor for the specified property
Throws
InvalidPropertyException if there is no such property

public abstract PropertyDescriptor[] getPropertyDescriptors ()

Also: SpringBeans

Obtain the PropertyDescriptors for the wrapped object (as determined by standard JavaBeans introspection).

Returns
  • the PropertyDescriptors for the wrapped object

public abstract Class getWrappedClass ()

Also: SpringBeans

Return the type of the wrapped JavaBean object.

Returns
  • the type of the wrapped bean instance, or null if no wrapped object has been set

public abstract Object getWrappedInstance ()

Also: SpringBeans

Return the bean instance wrapped by this object, if any.

Returns
  • the bean instance, or null if none set

public abstract boolean isAutoGrowNestedPaths ()

Also: SpringBeans

Return whether "auto-growing" of nested paths has been activated.

public abstract void setAutoGrowNestedPaths (boolean autoGrowNestedPaths)

Also: SpringBeans

Set whether this BeanWrapper should attempt to "auto-grow" a nested path that contains a null value.

If "true", a null path location will be populated with a default object value and traversed instead of resulting in a NullValueInNestedPathException. Turning this flag on also enables auto-growth of collection elements when accessing an out-of-bounds index.

Default is "false" on a plain BeanWrapper.