| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Default implementation of the BeanWrapper interface that should be sufficient for all normal uses. Caches introspection results for efficiency.
Note: this class never tries to load a class by name, as this can pose class loading problems in J2EE applications with multiple deployment modules. For example, loading a class by name won't work in some application servers if the class is used in a WAR but was loaded by the EJB class loader and the class to be loaded is in the WAR. (This class would use the EJB class loader, which couldn't see the required class.) We don't attempt to solve such problems by obtaining the classloader at runtime, because this violates the EJB programming restrictions.
Note: Regards property editors in org.springframework.beans.propertyeditors. Also explictly register the default ones to care for JREs that do not use the thread context class loader for editor search paths. Applications can either use a standard PropertyEditorManager to register a custom editor before using a BeanWrapperImpl instance, or call the instance's registerCustomEditor method to register an editor for the particular instance.
Collections custom property editors can be written against comma delimited String as String arrays are converted in such a format if the array itself is not assignable.
Constructor Summary | |
BeanWrapperImpl() Create new empty BeanWrapperImpl. | |
BeanWrapperImpl(Object object) Create new BeanWrapperImpl for the given object. | |
BeanWrapperImpl(Object object, String nestedPath) Create new BeanWrapperImpl for the given object, registering a nested path that the object is in. | |
BeanWrapperImpl(Class clazz) Create new BeanWrapperImpl, wrapping a new instance of the specified class. |
Method Summary | |
Object | doTypeConversionIfNecessary(Object newValue, Class requiredType) Convert the value to the required type (if necessary from a String). |
PropertyEditor | findCustomEditor(Class requiredType, String propertyPath) |
PropertyDescriptor | getPropertyDescriptor(String propertyName) |
PropertyDescriptor[] | getPropertyDescriptors() |
Object | getPropertyValue(String propertyName) |
Class | getWrappedClass() |
Object | getWrappedInstance() |
Object | invoke(String methodName, Object[] args) |
boolean | isReadableProperty(String propertyName) |
boolean | isWritableProperty(String propertyName) |
void | registerCustomEditor(Class requiredType, PropertyEditor propertyEditor) |
void | registerCustomEditor(Class requiredType, String propertyPath, PropertyEditor propertyEditor) |
void | setPropertyValue(String propertyName, Object value) |
void | setPropertyValue(PropertyValue pv) |
void | setPropertyValues(Map map) Bulk update from a Map. |
void | setPropertyValues(PropertyValues pvs) |
void | setPropertyValues(PropertyValues propertyValues, boolean ignoreUnknown) |
void | setWrappedInstance(Object object) Switches 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() This method is expensive! Only call for diagnostics and debugging reasons, not in production. |
Constructor Detail |
public BeanWrapperImpl()
public BeanWrapperImpl(Object object)
throws BeansException
public BeanWrapperImpl(Object object, String nestedPath)
throws BeansException
public BeanWrapperImpl(Class clazz)
throws BeansException
Method Detail |
public Object doTypeConversionIfNecessary(Object newValue, Class requiredType)
throws BeansException
public PropertyEditor findCustomEditor(Class requiredType, String propertyPath)
public PropertyDescriptor getPropertyDescriptor(String propertyName)
throws BeansException
public PropertyDescriptor[] getPropertyDescriptors()
public Object getPropertyValue(String propertyName)
throws BeansException
public Class getWrappedClass()
public Object getWrappedInstance()
public Object invoke(String methodName, Object[] args)
throws BeansException
public boolean isReadableProperty(String propertyName)
public boolean isWritableProperty(String propertyName)
public void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor)
public void registerCustomEditor(Class requiredType, String propertyPath, PropertyEditor propertyEditor)
public void setPropertyValue(String propertyName, Object value)
throws BeansException
public void setPropertyValue(PropertyValue pv)
throws BeansException
public void setPropertyValues(Map map)
throws BeansException
public void setPropertyValues(PropertyValues pvs)
throws BeansException
public void setPropertyValues(PropertyValues propertyValues, boolean ignoreUnknown)
throws BeansException
public void setWrappedInstance(Object object)
throws BeansException
public String toString()
Association Links |
to Class java.lang.String
to Class java.util.Map
to Class java.util.Map
to Class org.springframework.beans.CachedIntrospectionResults
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |