Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » beans » [javadoc | source]
org.springframework.beans
public class: BeanWrapperImpl [javadoc | source]
java.lang.Object
   org.springframework.beans.PropertyEditorRegistrySupport
      org.springframework.beans.AbstractPropertyAccessor
         org.springframework.beans.BeanWrapperImpl

All Implemented Interfaces:
    BeanWrapper, ConfigurablePropertyAccessor, PropertyEditorRegistry

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 #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.

BeanWrapperImpl will convert collection and array values to the corresponding target collections or arrays, if necessary. Custom property editors that deal with collections or arrays can either be written via PropertyEditor's setValue, or against a comma-delimited String via setAsText, as String arrays are converted in such a format if the array itself is not assignable.

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 factory method instead.

Constructor:
 public BeanWrapperImpl() 
 public BeanWrapperImpl(boolean registerDefaultEditors) 
 public BeanWrapperImpl(Object object) 
    Create new BeanWrapperImpl for the given object.
    Parameters:
    object - object wrapped by this BeanWrapper
 public BeanWrapperImpl(Class clazz) 
    Create new BeanWrapperImpl, wrapping a new instance of the specified class.
    Parameters:
    clazz - class to instantiate and wrap
 public BeanWrapperImpl(Object object,
    String nestedPath,
    Object rootObject) 
    Create new BeanWrapperImpl for the given object, registering a nested path that the object is in.
    Parameters:
    object - object wrapped by this BeanWrapper
    nestedPath - the nested path of the object
    rootObject - the root object at the top of the path
Method from org.springframework.beans.BeanWrapperImpl Summary:
convertForProperty,   convertIfNecessary,   doTypeConversionIfNecessary,   getBeanWrapperForPropertyPath,   getNestedPath,   getPropertyDescriptor,   getPropertyDescriptorInternal,   getPropertyDescriptors,   getPropertyType,   getPropertyValue,   getRootClass,   getRootInstance,   getWrappedClass,   getWrappedInstance,   isReadableProperty,   isWritableProperty,   newNestedBeanWrapper,   setIntrospectionClass,   setPropertyValue,   setPropertyValue,   setWrappedInstance,   setWrappedInstance,   toString
Methods from org.springframework.beans.AbstractPropertyAccessor:
convertIfNecessary,   getPropertyType,   getPropertyValue,   isExtractOldValueForEditor,   setExtractOldValueForEditor,   setPropertyValue,   setPropertyValue,   setPropertyValues,   setPropertyValues,   setPropertyValues,   setPropertyValues
Methods from org.springframework.beans.PropertyEditorRegistrySupport:
copyCustomEditorsTo,   copyDefaultEditorsTo,   findCustomEditor,   getDefaultEditor,   getPropertyType,   guessPropertyTypeFromEditors,   hasCustomEditorForElement,   isSharedEditor,   registerCustomEditor,   registerCustomEditor,   registerDefaultEditors,   registerSharedEditor,   useConfigValueEditors
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.beans.BeanWrapperImpl Detail:
 public Object convertForProperty(Object value,
    String propertyName) throws TypeMismatchException 
    Convert the given value for the specified property to the latter's type.

    This method is only intended for optimizations in a BeanFactory. Use the convertIfNecessary methods for programmatic conversion.

 public Object convertIfNecessary(Object value,
    Class requiredType,
    MethodParameter methodParam) throws TypeMismatchException 
 public Object doTypeConversionIfNecessary(Object value,
    Class requiredType) throws TypeMismatchException 
Deprecated! in - favor of convertIfNecessary

 protected BeanWrapperImpl getBeanWrapperForPropertyPath(String propertyPath) 
    Recursively navigate to return a BeanWrapper for the nested property path.
 public final String getNestedPath() 
    Return the nested path of the object wrapped by this BeanWrapper.
 public PropertyDescriptor getPropertyDescriptor(String propertyName) throws BeansException 
 protected PropertyDescriptor getPropertyDescriptorInternal(String propertyName) throws BeansException 
 public PropertyDescriptor[] getPropertyDescriptors() 
 public Class getPropertyType(String propertyName) throws BeansException 
 public Object getPropertyValue(String propertyName) throws BeansException 
 public final Class getRootClass() 
    Return the class of the root object at the top of the path of this BeanWrapper.
 public final Object getRootInstance() 
    Return the root object at the top of the path of this BeanWrapper.
 public final Class getWrappedClass() 
 public final Object getWrappedInstance() 
 public boolean isReadableProperty(String propertyName) 
 public boolean isWritableProperty(String propertyName) 
 protected BeanWrapperImpl newNestedBeanWrapper(Object object,
    String nestedPath) 
    Create a new nested BeanWrapper instance.

    Default implementation creates a BeanWrapperImpl instance. Can be overridden in subclasses to create a BeanWrapperImpl subclass.

 protected  void setIntrospectionClass(Class clazz) 
    Set the class to introspect. Needs to be called when the target object changes.
 public  void setPropertyValue(PropertyValue pv) throws BeansException 
 public  void setPropertyValue(String propertyName,
    Object value) throws BeansException 
 public  void setWrappedInstance(Object object) 
    Switch the target object, replacing the cached introspection results only if the class of the new object is different to that of the replaced object.
 public  void setWrappedInstance(Object object,
    String nestedPath,
    Object rootObject) 
    Switch the target object, replacing the cached introspection results only if the class of the new object is different to that of the replaced object.
 public String toString()