|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.springframework.beans.PropertyEditorRegistrySupport
org.springframework.beans.AbstractPropertyAccessor
org.tinygroup.weblayer.webcontext.parser.util.BeanWrapperImpl
public class BeanWrapperImpl
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.
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 |
| 构造方法详细信息 |
|---|
public BeanWrapperImpl()
setWrappedInstance(java.lang.Object)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)public BeanWrapperImpl(Object object)
object - object wrapped by this BeanWrapperpublic BeanWrapperImpl(Class clazz)
clazz - class to instantiate and wrap
public 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 path| 方法详细信息 |
|---|
public void setAutoGrowNestedPaths(boolean autoGrowNestedPaths)
public boolean isAutoGrowNestedPaths()
public void setWrappedInstance(Object object)
org.springframework.beans.BeanWrapper 中的 setWrappedInstanceobject - the new target object
public void setWrappedInstance(Object object,
String nestedPath,
Object rootObject)
object - the new target objectnestedPath - the nested path of the objectrootObject - the root object at the top of the pathpublic final Object getWrappedInstance()
org.springframework.beans.BeanWrapper 中的 getWrappedInstancepublic final Class getWrappedClass()
org.springframework.beans.BeanWrapper 中的 getWrappedClasspublic final String getNestedPath()
public final Object getRootInstance()
getNestedPath()public final Class getRootClass()
getNestedPath()protected void setIntrospectionClass(Class clazz)
clazz - the class to introspectpublic PropertyDescriptor[] getPropertyDescriptors()
org.springframework.beans.BeanWrapper 中的 getPropertyDescriptors
public PropertyDescriptor getPropertyDescriptor(String propertyName)
throws org.springframework.beans.BeansException
org.springframework.beans.BeanWrapper 中的 getPropertyDescriptororg.springframework.beans.BeansException
protected PropertyDescriptor getPropertyDescriptorInternal(String propertyName)
throws org.springframework.beans.BeansException
getPropertyDescriptor(java.lang.String):
Returns null if not found rather than throwing an exception.
propertyName - the property to obtain the descriptor for
null if not found
org.springframework.beans.BeansException - in case of introspection failure
public Class getPropertyType(String propertyName)
throws org.springframework.beans.BeansException
org.springframework.beans.PropertyAccessor 中的 getPropertyTypeorg.springframework.beans.AbstractPropertyAccessor 中的 getPropertyTypeorg.springframework.beans.BeansExceptionpublic boolean isReadableProperty(String propertyName)
org.springframework.beans.PropertyAccessor 中的 isReadablePropertypublic boolean isWritableProperty(String propertyName)
org.springframework.beans.PropertyAccessor 中的 isWritableProperty
public Object doTypeConversionIfNecessary(Object value,
Class requiredType)
throws org.springframework.beans.TypeMismatchException
convertIfNecessary
org.springframework.beans.TypeMismatchExceptionAbstractPropertyAccessor.convertIfNecessary(Object, Class)
public Object convertIfNecessary(Object value,
Class requiredType,
org.springframework.core.MethodParameter methodParam)
throws org.springframework.beans.TypeMismatchException
org.springframework.beans.TypeConverter 中的 convertIfNecessaryorg.springframework.beans.TypeMismatchException
public Object convertForProperty(Object value,
String propertyName)
throws org.springframework.beans.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)
org.springframework.beans.TypeMismatchException - if type conversion failedprotected BeanWrapperImpl getBeanWrapperForPropertyPath(String propertyPath)
propertyPath - property property path, which may be nested
protected BeanWrapperImpl newNestedBeanWrapper(Object object,
String nestedPath)
Default implementation creates a BeanWrapperImpl instance. Can be overridden in subclasses to create a BeanWrapperImpl subclass.
object - object wrapped by this BeanWrappernestedPath - the nested path of the object
public Object getPropertyValue(String propertyName)
throws org.springframework.beans.BeansException
org.springframework.beans.PropertyAccessor 中的 getPropertyValueorg.springframework.beans.AbstractPropertyAccessor 中的 getPropertyValueorg.springframework.beans.BeansException
public void setPropertyValue(String propertyName,
Object value)
throws org.springframework.beans.BeansException
org.springframework.beans.PropertyAccessor 中的 setPropertyValueorg.springframework.beans.AbstractPropertyAccessor 中的 setPropertyValueorg.springframework.beans.BeansException
public void setPropertyValue(PropertyValue pv)
throws org.springframework.beans.BeansException
org.springframework.beans.BeansExceptionpublic String toString()
Object 中的 toString
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||