org.springframework.beans.PropertyAccessor |
Known Indirect Subclasses |
Common interface for classes that can access named properties
(such as bean properties of an object or fields in an object)
Serves as base interface for BeanWrapper
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | NESTED_PROPERTY_SEPARATOR | Path separator for nested properties. | |||||||||
char | NESTED_PROPERTY_SEPARATOR_CHAR | ||||||||||
String | PROPERTY_KEY_PREFIX | Marker that indicates the start of a property key for an indexed or mapped property like "person.addresses[0]". | |||||||||
char | PROPERTY_KEY_PREFIX_CHAR | ||||||||||
String | PROPERTY_KEY_SUFFIX | Marker that indicates the end of a property key for an indexed or mapped property like "person.addresses[0]". | |||||||||
char | PROPERTY_KEY_SUFFIX_CHAR |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Determine the property type for the specified property,
either checking the property descriptor or checking the value
in case of an indexed or mapped element.
| |||||||||||
Return a type descriptor for the specified property:
preferably from the read method, falling back to the write method.
| |||||||||||
Get the current value of the specified property.
| |||||||||||
Determine whether the specified property is readable.
| |||||||||||
Determine whether the specified property is writable.
| |||||||||||
Set the specified value as current property value.
| |||||||||||
Set the specified value as current property value.
| |||||||||||
Perform a batch update with full control over behavior.
| |||||||||||
The preferred way to perform a batch update.
| |||||||||||
Perform a batch update from a Map.
| |||||||||||
Perform a batch update with more control over behavior.
|
Path separator for nested properties. Follows normal Java conventions: getFoo().getBar() would be "foo.bar".
Marker that indicates the start of a property key for an indexed or mapped property like "person.addresses[0]".
Marker that indicates the end of a property key for an indexed or mapped property like "person.addresses[0]".
Determine the property type for the specified property, either checking the property descriptor or checking the value in case of an indexed or mapped element.
propertyName | the property to check (may be a nested path and/or an indexed/mapped property) |
---|
null
if not determinableInvalidPropertyException | 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 |
Return a type descriptor for the specified property: preferably from the read method, falling back to the write method.
propertyName | the property to check (may be a nested path and/or an indexed/mapped property) |
---|
null
if not determinableInvalidPropertyException | if there is no such property or if the property isn't readable |
---|---|
BeansException |
Get the current value of the specified property.
propertyName | the name of the property to get the value of (may be a nested path and/or an indexed/mapped property) |
---|
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 |
Determine whether the specified property is readable.
Returns false
if the property doesn't exist.
propertyName | the property to check (may be a nested path and/or an indexed/mapped property) |
---|
Determine whether the specified property is writable.
Returns false
if the property doesn't exist.
propertyName | the property to check (may be a nested path and/or an indexed/mapped property) |
---|
Set the specified value as current property value.
pv | an object containing the new property 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 |
Set the specified value as current property value.
propertyName | the name of the property to set the value of (may be a nested path and/or an indexed/mapped property) |
---|---|
value | 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 |
Perform a batch update with full control over behavior.
Note that performing a batch update differs from performing a single update,
in that an implementation of this class will continue to update properties
if a recoverable error (such as a type mismatch, but not an
invalid field name or the like) is encountered, throwing a
PropertyBatchUpdateException
containing all the individual errors.
This exception can be examined later to see all binding errors.
Properties that were successfully updated remain changed.
pvs | PropertyValues to set on the target object |
---|---|
ignoreUnknown | should we ignore unknown properties (not found in the bean) |
ignoreInvalid | should we ignore invalid properties (found but not accessible) |
InvalidPropertyException | if there is no such property or if the property isn't writable |
---|---|
PropertyBatchUpdateException | if one or more PropertyAccessExceptions occured for specific properties during the batch update. This exception bundles all individual PropertyAccessExceptions. All other properties will have been successfully updated. |
BeansException |
The preferred way to perform a batch update.
Note that performing a batch update differs from performing a single update,
in that an implementation of this class will continue to update properties
if a recoverable error (such as a type mismatch, but not an
invalid field name or the like) is encountered, throwing a
PropertyBatchUpdateException
containing all the individual errors.
This exception can be examined later to see all binding errors.
Properties that were successfully updated remain changed.
Does not allow unknown fields or invalid fields.
pvs | PropertyValues to set on the target object |
---|
InvalidPropertyException | if there is no such property or if the property isn't writable |
---|---|
PropertyBatchUpdateException | if one or more PropertyAccessExceptions occured for specific properties during the batch update. This exception bundles all individual PropertyAccessExceptions. All other properties will have been successfully updated. |
BeansException |
Perform a batch update from a Map.
Bulk updates from PropertyValues are more powerful: This method is
provided for convenience. Behavior will be identical to that of
the setPropertyValues(PropertyValues)
method.
map | Map to take properties from. Contains property value objects, keyed by property name |
---|
InvalidPropertyException | if there is no such property or if the property isn't writable |
---|---|
PropertyBatchUpdateException | if one or more PropertyAccessExceptions occured for specific properties during the batch update. This exception bundles all individual PropertyAccessExceptions. All other properties will have been successfully updated. |
BeansException |
Perform a batch update with more control over behavior.
Note that performing a batch update differs from performing a single update,
in that an implementation of this class will continue to update properties
if a recoverable error (such as a type mismatch, but not an
invalid field name or the like) is encountered, throwing a
PropertyBatchUpdateException
containing all the individual errors.
This exception can be examined later to see all binding errors.
Properties that were successfully updated remain changed.
pvs | PropertyValues to set on the target object |
---|---|
ignoreUnknown | should we ignore unknown properties (not found in the bean) |
InvalidPropertyException | if there is no such property or if the property isn't writable |
---|---|
PropertyBatchUpdateException | if one or more PropertyAccessExceptions occured for specific properties during the batch update. This exception bundles all individual PropertyAccessExceptions. All other properties will have been successfully updated. |
BeansException |