public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements BeanWrapper
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.
PropertyEditorRegistrySupport.registerCustomEditor(java.lang.Class<?>, java.beans.PropertyEditor), 
AbstractPropertyAccessor.setPropertyValues(java.util.Map<?, ?>), 
AbstractNestablePropertyAccessor.setPropertyValue(java.lang.String, java.lang.Object), 
AbstractNestablePropertyAccessor.getPropertyValue(java.lang.String), 
AbstractNestablePropertyAccessor.getPropertyType(java.lang.String), 
BeanWrapper, 
PropertyEditorRegistrySupportAbstractNestablePropertyAccessor.PropertyHandler, AbstractNestablePropertyAccessor.PropertyTokenHolderNESTED_PROPERTY_SEPARATOR, NESTED_PROPERTY_SEPARATOR_CHAR, PROPERTY_KEY_PREFIX, PROPERTY_KEY_PREFIX_CHAR, PROPERTY_KEY_SUFFIX, PROPERTY_KEY_SUFFIX_CHAR| Constructor and Description | 
|---|
| BeanWrapperImpl()Create a new empty BeanWrapperImpl. | 
| BeanWrapperImpl(boolean registerDefaultEditors)Create a new empty BeanWrapperImpl. | 
| BeanWrapperImpl(Class<?> clazz)Create a new BeanWrapperImpl, wrapping a new instance of the specified class. | 
| BeanWrapperImpl(Object object)Create a new BeanWrapperImpl for the given object. | 
| BeanWrapperImpl(Object object,
               String nestedPath,
               Object rootObject)Create a new BeanWrapperImpl for the given object,
 registering a nested path that the object is in. | 
| Modifier and Type | Method and Description | 
|---|---|
| Object | convertForProperty(Object value,
                  String propertyName)Convert the given value for the specified property to the latter's type. | 
| protected NotWritablePropertyException | createNotWritablePropertyException(String propertyName)Create a  NotWritablePropertyExceptionfor the specified property. | 
| protected org.springframework.beans.BeanWrapperImpl.BeanPropertyHandler | getLocalPropertyHandler(String propertyName)Return a  AbstractNestablePropertyAccessor.PropertyHandlerfor the specified localpropertyName. | 
| PropertyDescriptor | getPropertyDescriptor(String propertyName)Obtain the property descriptor for a specific property
 of the wrapped object. | 
| PropertyDescriptor[] | getPropertyDescriptors()Obtain the PropertyDescriptors for the wrapped object
 (as determined by standard JavaBeans introspection). | 
| AccessControlContext | getSecurityContext()Return the security context used during the invocation of the wrapped instance methods. | 
| protected BeanWrapperImpl | newNestedPropertyAccessor(Object object,
                         String nestedPath)Create a new nested property accessor instance. | 
| void | setBeanInstance(Object object)Set a bean instance to hold, without any unwrapping of  Optional. | 
| protected void | setIntrospectionClass(Class<?> clazz)Set the class to introspect. | 
| void | setSecurityContext(AccessControlContext acc)Set the security context used during the invocation of the wrapped instance methods. | 
| 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. | 
convertForProperty, getAutoGrowCollectionLimit, getFinalPath, getNestedPath, getPropertyAccessorForPropertyPath, getPropertyHandler, getPropertyType, getPropertyTypeDescriptor, getPropertyValue, getPropertyValue, getRootClass, getRootInstance, getWrappedClass, getWrappedInstance, isReadableProperty, isWritableProperty, setAutoGrowCollectionLimit, setPropertyValue, setPropertyValue, setPropertyValue, setWrappedInstance, toStringisAutoGrowNestedPaths, isExtractOldValueForEditor, setAutoGrowNestedPaths, setExtractOldValueForEditor, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValuesconvertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessarycopyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getConversionService, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, overrideDefaultEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, setConversionService, useConfigValueEditorsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAutoGrowCollectionLimit, getWrappedClass, getWrappedInstance, setAutoGrowCollectionLimitgetConversionService, isAutoGrowNestedPaths, isExtractOldValueForEditor, setAutoGrowNestedPaths, setConversionService, setExtractOldValueForEditorgetPropertyType, getPropertyTypeDescriptor, getPropertyValue, isReadableProperty, isWritableProperty, setPropertyValue, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValuesfindCustomEditor, registerCustomEditor, registerCustomEditorconvertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessarypublic BeanWrapperImpl()
public BeanWrapperImpl(boolean registerDefaultEditors)
registerDefaultEditors - whether to register default editors
 (can be suppressed if the BeanWrapper won't need any type conversion)setWrappedInstance(java.lang.Object, java.lang.String, java.lang.Object)public BeanWrapperImpl(Object object)
object - object wrapped by this BeanWrapperpublic BeanWrapperImpl(Class<?> clazz)
clazz - class to instantiate and wrappublic BeanWrapperImpl(Object object, String nestedPath, Object rootObject)
object - object wrapped by this BeanWrappernestedPath - the nested path of the objectrootObject - the root object at the top of the pathpublic void setBeanInstance(Object object)
Optional.object - the actual target objectAbstractNestablePropertyAccessor.setWrappedInstance(Object)public void setWrappedInstance(Object object, @Nullable String nestedPath, @Nullable Object rootObject)
AbstractNestablePropertyAccessorsetWrappedInstance in class AbstractNestablePropertyAccessorobject - the new target objectnestedPath - the nested path of the objectrootObject - the root object at the top of the pathprotected void setIntrospectionClass(Class<?> clazz)
clazz - the class to introspectpublic void setSecurityContext(@Nullable
                               AccessControlContext acc)
@Nullable public AccessControlContext getSecurityContext()
@Nullable public Object convertForProperty(@Nullable Object value, String propertyName) throws TypeMismatchException
This method is only intended for optimizations in a BeanFactory.
 Use the convertIfNecessary methods for programmatic conversion.
value - the value to convertpropertyName - the target property
 (note that nested or indexed properties are not supported here)TypeMismatchException - if type conversion failed@Nullable protected org.springframework.beans.BeanWrapperImpl.BeanPropertyHandler getLocalPropertyHandler(String propertyName)
AbstractNestablePropertyAccessorAbstractNestablePropertyAccessor.PropertyHandler for the specified local propertyName.
 Only used to reach a property available in the current context.getLocalPropertyHandler in class AbstractNestablePropertyAccessorpropertyName - the name of a local propertynull if it has not been foundprotected BeanWrapperImpl newNestedPropertyAccessor(Object object, String nestedPath)
AbstractNestablePropertyAccessornewNestedPropertyAccessor in class AbstractNestablePropertyAccessorobject - object wrapped by this PropertyAccessornestedPath - the nested path of the objectprotected NotWritablePropertyException createNotWritablePropertyException(String propertyName)
AbstractNestablePropertyAccessorNotWritablePropertyException for the specified property.createNotWritablePropertyException in class AbstractNestablePropertyAccessorpublic PropertyDescriptor[] getPropertyDescriptors()
BeanWrappergetPropertyDescriptors in interface BeanWrapperpublic PropertyDescriptor getPropertyDescriptor(String propertyName) throws InvalidPropertyException
BeanWrappergetPropertyDescriptor in interface BeanWrapperpropertyName - the property to obtain the descriptor for
 (may be a nested path, but no indexed/mapped property)InvalidPropertyException - if there is no such property