Class BeanWrapperImpl

All Implemented Interfaces:
BeanWrapper, ConfigurablePropertyAccessor, PropertyAccessor, PropertyEditorRegistry, TypeConverter

public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements BeanWrapper
Default BeanWrapper implementation that should be sufficient for all typical use cases. Caches introspection results for efficiency.

Note: Auto-registers default property editors from the org.springframework.beans.propertyeditors package, which apply in addition to the JDK's standard PropertyEditors. Applications can call the PropertyEditorRegistrySupport.registerCustomEditor(Class, java.beans.PropertyEditor) method to register an editor for a particular instance (i.e. they are not shared across the application). See the base class PropertyEditorRegistrySupport for details.

NOTE: As of Spring 2.5, this is - for almost all purposes - an internal class. It is just public in order to allow for access from other framework packages. For standard application access purposes, use the PropertyAccessorFactory.forBeanPropertyAccess(java.lang.Object) factory method instead.

Since:
15 April 2001
Author:
Rod Johnson, Juergen Hoeller, Rob Harrop, Stephane Nicoll
See Also:
  • Constructor Details

    • BeanWrapperImpl

      public BeanWrapperImpl()
      Create a new empty BeanWrapperImpl. Wrapped instance needs to be set afterwards. Registers default editors.
      See Also:
    • BeanWrapperImpl

      public BeanWrapperImpl(boolean registerDefaultEditors)
      Create a new empty BeanWrapperImpl. Wrapped instance needs to be set afterwards.
      Parameters:
      registerDefaultEditors - whether to register default editors (can be suppressed if the BeanWrapper won't need any type conversion)
      See Also:
    • BeanWrapperImpl

      public BeanWrapperImpl(Object object)
      Create a new BeanWrapperImpl for the given object.
      Parameters:
      object - the object wrapped by this BeanWrapper
    • BeanWrapperImpl

      public BeanWrapperImpl(Class<?> clazz)
      Create a new BeanWrapperImpl, wrapping a new instance of the specified class.
      Parameters:
      clazz - class to instantiate and wrap
    • BeanWrapperImpl

      public BeanWrapperImpl(Object object, String nestedPath, Object rootObject)
      Create a new BeanWrapperImpl for the given object, registering a nested path that the object is in.
      Parameters:
      object - the object wrapped by this BeanWrapper
      nestedPath - the nested path of the object
      rootObject - the root object at the top of the path
  • Method Details