org.tinygroup.weblayer.webcontext.parser.util
类 BeanWrapperImpl

java.lang.Object
  继承者 org.springframework.beans.PropertyEditorRegistrySupport
      继承者 org.springframework.beans.AbstractPropertyAccessor
          继承者 org.tinygroup.weblayer.webcontext.parser.util.BeanWrapperImpl
所有已实现的接口:
org.springframework.beans.BeanWrapper, org.springframework.beans.ConfigurablePropertyAccessor, org.springframework.beans.PropertyAccessor, org.springframework.beans.PropertyEditorRegistry, org.springframework.beans.TypeConverter

public class BeanWrapperImpl
extends org.springframework.beans.AbstractPropertyAccessor
implements org.springframework.beans.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.

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(java.lang.Object) factory method instead.

从以下版本开始:
15 April 2001
作者:
Rod Johnson, Juergen Hoeller, Rob Harrop
另请参见:
PropertyEditorRegistrySupport.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor), AbstractPropertyAccessor.setPropertyValues(java.util.Map), setPropertyValue(java.lang.String, java.lang.Object), getPropertyValue(java.lang.String), getPropertyType(java.lang.String), BeanWrapper, PropertyEditorRegistrySupport

字段摘要
 
从接口 org.springframework.beans.PropertyAccessor 继承的字段
NESTED_PROPERTY_SEPARATOR, NESTED_PROPERTY_SEPARATOR_CHAR, PROPERTY_KEY_PREFIX, PROPERTY_KEY_PREFIX_CHAR, PROPERTY_KEY_SUFFIX, PROPERTY_KEY_SUFFIX_CHAR
 
构造方法摘要
BeanWrapperImpl()
          Create new empty BeanWrapperImpl.
BeanWrapperImpl(boolean registerDefaultEditors)
          Create new empty BeanWrapperImpl.
BeanWrapperImpl(Class clazz)
          Create new BeanWrapperImpl, wrapping a new instance of the specified class.
BeanWrapperImpl(Object object)
          Create new BeanWrapperImpl for the given object.
BeanWrapperImpl(Object object, String nestedPath, Object rootObject)
          Create new BeanWrapperImpl for the given object, registering a nested path that the object is in.
 
方法摘要
 Object convertForProperty(Object value, String propertyName)
          Convert the given value for the specified property to the latter's type.
 Object convertIfNecessary(Object value, Class requiredType, org.springframework.core.MethodParameter methodParam)
           
 Object doTypeConversionIfNecessary(Object value, Class requiredType)
          已过时。 in favor of convertIfNecessary
protected  BeanWrapperImpl getBeanWrapperForPropertyPath(String propertyPath)
          Recursively navigate to return a BeanWrapper for the nested property path.
 String getNestedPath()
          Return the nested path of the object wrapped by this BeanWrapper.
 PropertyDescriptor getPropertyDescriptor(String propertyName)
           
protected  PropertyDescriptor getPropertyDescriptorInternal(String propertyName)
          Internal version of getPropertyDescriptor(java.lang.String): Returns null if not found rather than throwing an exception.
 PropertyDescriptor[] getPropertyDescriptors()
           
 Class getPropertyType(String propertyName)
           
 Object getPropertyValue(String propertyName)
           
 Class getRootClass()
          Return the class of the root object at the top of the path of this BeanWrapper.
 Object getRootInstance()
          Return the root object at the top of the path of this BeanWrapper.
 Class getWrappedClass()
           
 Object getWrappedInstance()
           
 boolean isAutoGrowNestedPaths()
          If this BeanWrapper should "auto grow" nested paths.
 boolean isReadableProperty(String propertyName)
           
 boolean isWritableProperty(String propertyName)
           
protected  BeanWrapperImpl newNestedBeanWrapper(Object object, String nestedPath)
          Create a new nested BeanWrapper instance.
 void setAutoGrowNestedPaths(boolean autoGrowNestedPaths)
          If this BeanWrapper should "auto grow" nested paths.
protected  void setIntrospectionClass(Class clazz)
          Set the class to introspect.
 void setPropertyValue(PropertyValue pv)
           
 void setPropertyValue(String propertyName, Object value)
           
 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.
 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.
 String toString()
           
 
从类 org.springframework.beans.AbstractPropertyAccessor 继承的方法
convertIfNecessary, isExtractOldValueForEditor, setExtractOldValueForEditor, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues
 
从类 org.springframework.beans.PropertyEditorRegistrySupport 继承的方法
copyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, isSharedEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, registerSharedEditor, useConfigValueEditors
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
从接口 org.springframework.beans.ConfigurablePropertyAccessor 继承的方法
isExtractOldValueForEditor, setExtractOldValueForEditor
 
从接口 org.springframework.beans.PropertyAccessor 继承的方法
setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues
 
从接口 org.springframework.beans.PropertyEditorRegistry 继承的方法
findCustomEditor, registerCustomEditor, registerCustomEditor
 
从接口 org.springframework.beans.TypeConverter 继承的方法
convertIfNecessary
 

构造方法详细信息

BeanWrapperImpl

public BeanWrapperImpl()
Create new empty BeanWrapperImpl. Wrapped instance needs to be set afterwards. Registers default editors.

另请参见:
setWrappedInstance(java.lang.Object)

BeanWrapperImpl

public BeanWrapperImpl(boolean registerDefaultEditors)
Create new empty BeanWrapperImpl. Wrapped instance needs to be set afterwards.

参数:
registerDefaultEditors - whether to register default editors (can be suppressed if the BeanWrapper won't need any type conversion)
另请参见:
setWrappedInstance(java.lang.Object)

BeanWrapperImpl

public BeanWrapperImpl(Object object)
Create new BeanWrapperImpl for the given object.

参数:
object - object wrapped by this BeanWrapper

BeanWrapperImpl

public BeanWrapperImpl(Class clazz)
Create new BeanWrapperImpl, wrapping a new instance of the specified class.

参数:
clazz - class to instantiate and wrap

BeanWrapperImpl

public BeanWrapperImpl(Object object,
                       String nestedPath,
                       Object rootObject)
Create new BeanWrapperImpl for the given object, registering a nested path that the object is in.

参数:
object - object wrapped by this BeanWrapper
nestedPath - the nested path of the object
rootObject - the root object at the top of the path
方法详细信息

setAutoGrowNestedPaths

public void setAutoGrowNestedPaths(boolean autoGrowNestedPaths)
If this BeanWrapper should "auto grow" nested paths. When true, auto growth is triggered on nested paths when null values are encountered. When true, auto growth is triggered on collection properties when out of bounds indexes are accessed. Default is false.


isAutoGrowNestedPaths

public boolean isAutoGrowNestedPaths()
If this BeanWrapper should "auto grow" nested paths.


setWrappedInstance

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.

指定者:
接口 org.springframework.beans.BeanWrapper 中的 setWrappedInstance
参数:
object - the new target object

setWrappedInstance

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.

参数:
object - the new target object
nestedPath - the nested path of the object
rootObject - the root object at the top of the path

getWrappedInstance

public final Object getWrappedInstance()
指定者:
接口 org.springframework.beans.BeanWrapper 中的 getWrappedInstance

getWrappedClass

public final Class getWrappedClass()
指定者:
接口 org.springframework.beans.BeanWrapper 中的 getWrappedClass

getNestedPath

public final String getNestedPath()
Return the nested path of the object wrapped by this BeanWrapper.


getRootInstance

public final Object getRootInstance()
Return the root object at the top of the path of this BeanWrapper.

另请参见:
getNestedPath()

getRootClass

public final Class getRootClass()
Return the class of the root object at the top of the path of this BeanWrapper.

另请参见:
getNestedPath()

setIntrospectionClass

protected void setIntrospectionClass(Class clazz)
Set the class to introspect. Needs to be called when the target object changes.

参数:
clazz - the class to introspect

getPropertyDescriptors

public PropertyDescriptor[] getPropertyDescriptors()
指定者:
接口 org.springframework.beans.BeanWrapper 中的 getPropertyDescriptors

getPropertyDescriptor

public PropertyDescriptor getPropertyDescriptor(String propertyName)
                                         throws org.springframework.beans.BeansException
指定者:
接口 org.springframework.beans.BeanWrapper 中的 getPropertyDescriptor
抛出:
org.springframework.beans.BeansException

getPropertyDescriptorInternal

protected PropertyDescriptor getPropertyDescriptorInternal(String propertyName)
                                                    throws org.springframework.beans.BeansException
Internal version of getPropertyDescriptor(java.lang.String): Returns null if not found rather than throwing an exception.

参数:
propertyName - the property to obtain the descriptor for
返回:
the property descriptor for the specified property, or null if not found
抛出:
org.springframework.beans.BeansException - in case of introspection failure

getPropertyType

public Class getPropertyType(String propertyName)
                      throws org.springframework.beans.BeansException
指定者:
接口 org.springframework.beans.PropertyAccessor 中的 getPropertyType
覆盖:
org.springframework.beans.AbstractPropertyAccessor 中的 getPropertyType
抛出:
org.springframework.beans.BeansException

isReadableProperty

public boolean isReadableProperty(String propertyName)
指定者:
接口 org.springframework.beans.PropertyAccessor 中的 isReadableProperty

isWritableProperty

public boolean isWritableProperty(String propertyName)
指定者:
接口 org.springframework.beans.PropertyAccessor 中的 isWritableProperty

doTypeConversionIfNecessary

public Object doTypeConversionIfNecessary(Object value,
                                          Class requiredType)
                                   throws org.springframework.beans.TypeMismatchException
已过时。 in favor of convertIfNecessary

抛出:
org.springframework.beans.TypeMismatchException
另请参见:
AbstractPropertyAccessor.convertIfNecessary(Object, Class)

convertIfNecessary

public Object convertIfNecessary(Object value,
                                 Class requiredType,
                                 org.springframework.core.MethodParameter methodParam)
                          throws org.springframework.beans.TypeMismatchException
指定者:
接口 org.springframework.beans.TypeConverter 中的 convertIfNecessary
抛出:
org.springframework.beans.TypeMismatchException

convertForProperty

public Object convertForProperty(Object value,
                                 String propertyName)
                          throws org.springframework.beans.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.

参数:
value - the value to convert
propertyName - the target property (note that nested or indexed properties are not supported here)
返回:
the new value, possibly the result of type conversion
抛出:
org.springframework.beans.TypeMismatchException - if type conversion failed

getBeanWrapperForPropertyPath

protected BeanWrapperImpl getBeanWrapperForPropertyPath(String propertyPath)
Recursively navigate to return a BeanWrapper for the nested property path.

参数:
propertyPath - property property path, which may be nested
返回:
a BeanWrapper for the target bean

newNestedBeanWrapper

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.

参数:
object - object wrapped by this BeanWrapper
nestedPath - the nested path of the object
返回:
the nested BeanWrapper instance

getPropertyValue

public Object getPropertyValue(String propertyName)
                        throws org.springframework.beans.BeansException
指定者:
接口 org.springframework.beans.PropertyAccessor 中的 getPropertyValue
指定者:
org.springframework.beans.AbstractPropertyAccessor 中的 getPropertyValue
抛出:
org.springframework.beans.BeansException

setPropertyValue

public void setPropertyValue(String propertyName,
                             Object value)
                      throws org.springframework.beans.BeansException
指定者:
接口 org.springframework.beans.PropertyAccessor 中的 setPropertyValue
指定者:
org.springframework.beans.AbstractPropertyAccessor 中的 setPropertyValue
抛出:
org.springframework.beans.BeansException

setPropertyValue

public void setPropertyValue(PropertyValue pv)
                      throws org.springframework.beans.BeansException
抛出:
org.springframework.beans.BeansException

toString

public String toString()
覆盖:
Object 中的 toString


Copyright © 2006–2014 开源组织. All rights reserved.