public abstract class AbstractPropertyBindingResult extends AbstractBindingResult
BindingResult
implementations that work with
Spring's PropertyAccessor
mechanism.
Pre-implements field access through delegation to the corresponding
PropertyAccessor methods.getPropertyAccessor()
,
PropertyAccessor
,
ConfigurablePropertyAccessor
,
Serialized FormMODEL_KEY_PREFIX
NESTED_PATH_SEPARATOR
Modifier | Constructor and Description |
---|---|
protected |
AbstractPropertyBindingResult(java.lang.String objectName)
Create a new AbstractPropertyBindingResult instance.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
canonicalFieldName(java.lang.String field)
Returns the canonical property name.
|
java.beans.PropertyEditor |
findEditor(java.lang.String field,
java.lang.Class<?> valueType)
This implementation exposes a PropertyEditor adapter for a Formatter,
if applicable.
|
protected java.lang.Object |
formatFieldValue(java.lang.String field,
java.lang.Object value)
Formats the field value based on registered PropertyEditors.
|
protected java.lang.Object |
getActualFieldValue(java.lang.String field)
Fetches the field value from the PropertyAccessor.
|
protected java.beans.PropertyEditor |
getCustomEditor(java.lang.String fixedField)
Retrieve the custom PropertyEditor for the given field, if any.
|
java.lang.Class<?> |
getFieldType(java.lang.String field)
Determines the field type from the property type.
|
abstract ConfigurablePropertyAccessor |
getPropertyAccessor()
Provide the PropertyAccessor to work with, according to the
concrete strategy of access.
|
PropertyEditorRegistry |
getPropertyEditorRegistry()
Returns the underlying PropertyAccessor.
|
void |
initConversion(ConversionService conversionService) |
addAllErrors, addError, equals, getAllErrors, getErrorCount, getFieldError, getFieldError, getFieldErrors, getFieldErrors, getFieldValue, getGlobalError, getGlobalErrors, getMessageCodesResolver, getModel, getObjectName, getRawFieldValue, getSuppressedFields, getTarget, hasErrors, hashCode, recordFieldValue, recordSuppressedField, reject, rejectValue, resolveMessageCodes, resolveMessageCodes, setMessageCodesResolver
doSetNestedPath, fixedField, getFieldErrorCount, getFieldErrorCount, getGlobalErrorCount, getNestedPath, hasFieldErrors, hasFieldErrors, hasGlobalErrors, isMatchingFieldError, popNestedPath, pushNestedPath, reject, reject, rejectValue, rejectValue, setNestedPath, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getFieldErrorCount, getFieldErrorCount, getGlobalErrorCount, getNestedPath, hasFieldErrors, hasFieldErrors, hasGlobalErrors, popNestedPath, pushNestedPath, reject, reject, rejectValue, rejectValue, setNestedPath
protected AbstractPropertyBindingResult(java.lang.String objectName)
objectName
- the name of the target objectDefaultMessageCodesResolver
public void initConversion(ConversionService conversionService)
public PropertyEditorRegistry getPropertyEditorRegistry()
getPropertyEditorRegistry
in interface BindingResult
getPropertyEditorRegistry
in class AbstractBindingResult
null
if none
available for this BindingResultgetPropertyAccessor()
protected java.lang.String canonicalFieldName(java.lang.String field)
canonicalFieldName
in class AbstractErrors
field
- the original field namePropertyAccessorUtils.canonicalPropertyName(java.lang.String)
@Nullable public java.lang.Class<?> getFieldType(@Nullable java.lang.String field)
getFieldType
in interface Errors
getFieldType
in class AbstractBindingResult
field
- the field namenull
if not determinablegetPropertyAccessor()
@Nullable protected java.lang.Object getActualFieldValue(java.lang.String field)
getActualFieldValue
in class AbstractBindingResult
field
- the field to checkgetPropertyAccessor()
protected java.lang.Object formatFieldValue(java.lang.String field, @Nullable java.lang.Object value)
formatFieldValue
in class AbstractBindingResult
field
- the field to checkvalue
- the value of the field (either a rejected value
other than from a binding error, or an actual field value)getCustomEditor(java.lang.String)
@Nullable protected java.beans.PropertyEditor getCustomEditor(java.lang.String fixedField)
fixedField
- the fully qualified field namenull
@Nullable public java.beans.PropertyEditor findEditor(@Nullable java.lang.String field, @Nullable java.lang.Class<?> valueType)
findEditor
in interface BindingResult
findEditor
in class AbstractBindingResult
field
- the path of the property (name or nested path), or
null
if looking for an editor for all properties of the given typevalueType
- the type of the property (can be null
if a property
is given but should be specified in any case for consistency checking)null
if nonepublic abstract ConfigurablePropertyAccessor getPropertyAccessor()
Note that a PropertyAccessor used by a BindingResult should always have its "extractOldValueForEditor" flag set to "true" by default, since this is typically possible without side effects for model objects that serve as data binding target.