|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.PropertyEditorRegistrySupport org.springframework.beans.AbstractPropertyAccessor org.springframework.beans.DirectFieldAccessor
public class DirectFieldAccessor
PropertyAccessor implementation that directly accesses instance fields. Allows for direct binding to fields instead of going through JavaBean setters.
This implementation just supports fields in the actual target object. It is not able to traverse nested fields.
A DirectFieldAccessor's default for the "extractOldValueForEditor" setting is "true", since a field can always be read without side effects.
AbstractPropertyAccessor.setExtractOldValueForEditor(boolean)
,
BeanWrapper
,
DirectFieldBindingResult
,
DataBinder.initDirectFieldAccess()
Field Summary |
---|
Fields inherited from interface 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 |
Constructor Summary | |
---|---|
DirectFieldAccessor(Object target)
Create a new DirectFieldAccessor for the given target object. |
Method Summary | |
---|---|
Class |
getPropertyType(String propertyName)
Determine the property type for the given property path. |
Object |
getPropertyValue(String propertyName)
Actually get the value of a property. |
boolean |
isReadableProperty(String propertyName)
Determine whether the specified property is readable. |
boolean |
isWritableProperty(String propertyName)
Determine whether the specified property is writable. |
void |
setPropertyValue(String propertyName,
Object newValue)
Actually set a property value. |
Methods inherited from class org.springframework.beans.AbstractPropertyAccessor |
---|
isExtractOldValueForEditor, setExtractOldValueForEditor, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues |
Methods inherited from class org.springframework.beans.PropertyEditorRegistrySupport |
---|
copyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, registerCustomEditor, registerCustomEditor, registerDefaultEditors |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.beans.PropertyEditorRegistry |
---|
findCustomEditor, registerCustomEditor, registerCustomEditor |
Constructor Detail |
---|
public DirectFieldAccessor(Object target)
target
- the target object to accessMethod Detail |
---|
public boolean isReadableProperty(String propertyName) throws BeansException
PropertyAccessor
Returns false
if the property doesn't exist.
propertyName
- the property to check
(may be a nested path and/or an indexed/mapped property)
BeansException
public boolean isWritableProperty(String propertyName) throws BeansException
PropertyAccessor
Returns false
if the property doesn't exist.
propertyName
- the property to check
(may be a nested path and/or an indexed/mapped property)
BeansException
public Class getPropertyType(String propertyName) throws BeansException
PropertyEditorRegistrySupport
findCustomEditor
if no required type has been specified,
to be able to find a type-specific editor even if just given a property path.
Default implementation always returns null
.
BeanWrapperImpl overrides this with the standard getPropertyType
method as defined by the BeanWrapper interface.
getPropertyType
in interface PropertyAccessor
getPropertyType
in class AbstractPropertyAccessor
propertyName
- the property path to determine the type for
null
if not determinable
InvalidPropertyException
- if there is no such property or
if the property isn't readable
PropertyAccessException
- if the property was valid but the
accessor method failed
BeansException
PropertyAccessor.getPropertyType(String)
public Object getPropertyValue(String propertyName) throws BeansException
AbstractPropertyAccessor
getPropertyValue
in interface PropertyAccessor
getPropertyValue
in class AbstractPropertyAccessor
propertyName
- name of the property to get the value of
InvalidPropertyException
- if there is no such property or
if the property isn't readable
PropertyAccessException
- if the property was valid but the
accessor method failed
BeansException
public void setPropertyValue(String propertyName, Object newValue) throws BeansException
AbstractPropertyAccessor
setPropertyValue
in interface PropertyAccessor
setPropertyValue
in class AbstractPropertyAccessor
propertyName
- name of the property to set value ofnewValue
- the new value
InvalidPropertyException
- if there is no such property or
if the property isn't writable
PropertyAccessException
- if the property was valid but the
accessor method failed or a type mismatch occured
BeansException
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |