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. 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 factory method instead.
registerCustomEditor, setPropertyValues, setPropertyValue, getPropertyValue, getPropertyType, BeanWrapper, PropertyEditorRegistrySupport
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private CachedIntrospectionResults | cachedIntrospectionResults
Cached introspections results for this object, to prevent encountering the cost of JavaBeans introspection every time. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | BeanWrapperImpl(boolean
whether to register default editors
(can be suppressed if the BeanWrapper won't need any type conversion) registerDefaultEditors)Create a new empty BeanWrapperImpl. |
| public | BeanWrapperImpl(Object
the object wrapped by this BeanWrapper object)Create a new BeanWrapperImpl for the given object. |
| public | BeanWrapperImpl(Class<?>
class to instantiate and wrap clazz)Create a new BeanWrapperImpl, wrapping a new instance of the specified class. |
| public | BeanWrapperImpl(Object
the object wrapped by this BeanWrapper object, String the nested path of the object nestedPath, Object the root object at the top of the path rootObject)Create a new BeanWrapperImpl for the given object, registering a nested path that the object is in. |
| private | BeanWrapperImpl(Object
the object wrapped by this BeanWrapper object, String the nested path of the object nestedPath, BeanWrapperImpl the containing BeanWrapper (must not be parent)null)Create a new BeanWrapperImpl for the given object, registering a nested path that the object is in. |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: the new value, possibly the result of type conversionthe value to convert value, String the target property
(note that nested or indexed properties are not supported here) propertyName)Convert the given value for the specified property to the latter's type. |
| protected NotWritablePropertyException | createNotWritablePropertyException(String propertyName)
Implements abstract org. Create a |
| private CachedIntrospectionResults | getCachedIntrospectionResults()
Obtain a lazily initialized CachedIntrospectionResults instance for the wrapped object. |
| protected BeanWrapperImpl. | getLocalPropertyHandler(String
the name of a local property propertyName)Implements abstract org. Return a |
| public PropertyDescriptor | getPropertyDescriptor(String
the property to obtain the descriptor for
(may be a nested path, but not an indexed/mapped property) propertyName)Implements org. Obtain the property descriptor for a specific property of the wrapped object. |
| public PropertyDescriptor[] | getPropertyDescriptors()
Implements org. Obtain the PropertyDescriptors for the wrapped object (as determined by standard JavaBeans introspection). |
| protected BeanWrapperImpl | newNestedPropertyAccessor(Object
the object wrapped by this PropertyAccessor object, String the nested path of the object nestedPath)Implements abstract org. Create a new nested property accessor instance. |
| public void | setBeanInstance(Object
the actual target object object)Set a bean instance to hold, without any unwrapping of |
| protected void | |
| public void | setWrappedInstance(Object
the new target object object, String the nested path of the object nestedPath, Object the root object at the top of the path rootObject)Overrides org. 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. |
| cachedIntrospectionResults | back to summary |
|---|---|
| private CachedIntrospectionResults cachedIntrospectionResults Cached introspections results for this object, to prevent encountering the cost of JavaBeans introspection every time. | |
| BeanWrapperImpl | back to summary |
|---|---|
| public BeanWrapperImpl() Create a new empty BeanWrapperImpl. Wrapped instance needs to be set afterwards. Registers default editors.
| |
| BeanWrapperImpl | back to summary |
|---|---|
| public BeanWrapperImpl(boolean registerDefaultEditors) Create a new empty BeanWrapperImpl. Wrapped instance needs to be set afterwards.
| |
| BeanWrapperImpl | back to summary |
|---|---|
| public BeanWrapperImpl(Object object) Create a new BeanWrapperImpl for the given object.
| |
| BeanWrapperImpl | back to summary |
|---|---|
| public BeanWrapperImpl(Class<?> clazz) Create a new BeanWrapperImpl, wrapping a new instance of the specified class.
| |
| BeanWrapperImpl | back to summary |
|---|---|
| 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. | |
| BeanWrapperImpl | back to summary |
|---|---|
| private BeanWrapperImpl(Object object, String nestedPath, BeanWrapperImpl parent) Create a new BeanWrapperImpl for the given object, registering a nested path that the object is in.
| |
| convertForProperty | back to summary |
|---|---|
| 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
| |
| createNotWritablePropertyException | back to summary |
|---|---|
| protected NotWritablePropertyException createNotWritablePropertyException(String propertyName) Implements abstract org. Doc from org. Create a
| |
| getCachedIntrospectionResults | back to summary |
|---|---|
| private CachedIntrospectionResults getCachedIntrospectionResults() Obtain a lazily initialized CachedIntrospectionResults instance for the wrapped object. | |
| getLocalPropertyHandler | back to summary |
|---|---|
| protected BeanWrapperImpl. Implements abstract org. Doc from org. Return a
| |
| getPropertyDescriptor | back to summary |
|---|---|
| public PropertyDescriptor getPropertyDescriptor(String propertyName) throws InvalidPropertyException Implements org. Doc from org. Obtain the property descriptor for a specific property of the wrapped object.
| |
| getPropertyDescriptors | back to summary |
|---|---|
| public PropertyDescriptor[] getPropertyDescriptors() Implements org. Doc from org. Obtain the PropertyDescriptors for the wrapped object (as determined by standard JavaBeans introspection).
| |
| newNestedPropertyAccessor | back to summary |
|---|---|
| protected BeanWrapperImpl newNestedPropertyAccessor(Object object, String nestedPath) Implements abstract org. Doc from org. Create a new nested property accessor instance. Can be overridden in subclasses to create a PropertyAccessor subclass.
| |
| setBeanInstance | back to summary |
|---|---|
| public void setBeanInstance(Object object) Set a bean instance to hold, without any unwrapping of
| |
| setIntrospectionClass | back to summary |
|---|---|
| protected void setIntrospectionClass(Class<?> clazz) Set the class to introspect. Needs to be called when the target object changes.
| |
| setWrappedInstance | back to summary |
|---|---|
| public void setWrappedInstance(Object object, String nestedPath, Object rootObject) Overrides org. Doc from org. 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. | |
| Modifier and Type | Field and Description |
|---|---|
| private final GenericTypeAwarePropertyDescriptor |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public TypeDescriptor | getCollectionType(int nestingLevel)
Overrides org.
|
| public TypeDescriptor | getMapValueType(int nestingLevel)
Overrides org.
|
| public ResolvableType | |
| public Object | getValue()
Implements abstract org.
|
| public TypeDescriptor | nested(int level)
Implements abstract org.
|
| public void | setValue(Object value)
Implements abstract org.
|
| public boolean | |
| public TypeDescriptor |
| pd | back to summary |
|---|---|
| private final GenericTypeAwarePropertyDescriptor pd | |
| BeanPropertyHandler | back to summary |
|---|---|
| public BeanPropertyHandler(GenericTypeAwarePropertyDescriptor pd) | |
| getCollectionType | back to summary |
|---|---|
| public TypeDescriptor getCollectionType(int nestingLevel) Overrides org.
| |
| getMapValueType | back to summary |
|---|---|
| public TypeDescriptor getMapValueType(int nestingLevel) Overrides org.
| |
| getResolvableType | back to summary |
|---|---|
| public ResolvableType getResolvableType() Implements abstract org.
| |
| getValue | back to summary |
|---|---|
| public Object getValue() throws Exception Implements abstract org. | |
| nested | back to summary |
|---|---|
| public TypeDescriptor nested(int level) Implements abstract org. | |
| setValue | back to summary |
|---|---|
| public void setValue(Object value) throws Exception Implements abstract org.
| |
| setValueFallbackIfPossible | back to summary |
|---|---|
public boolean setValueFallbackIfPossible(Object value)
| |
| toTypeDescriptor | back to summary |
|---|---|
| public TypeDescriptor toTypeDescriptor() Implements abstract org.
| |