Top Description Fields Constructors Methods
org.springframework.validation

public abstract Class AbstractPropertyBindingResult

extends AbstractBindingResult
Class Inheritance
Known Direct Subclasses
org.springframework.validation.BeanPropertyBindingResult, org.springframework.validation.DirectFieldBindingResult
Annotations
@SuppressWarnings:serial
Imports
java.beans.PropertyEditor, org.springframework.beans.BeanUtils, .ConfigurablePropertyAccessor, .PropertyAccessorUtils, .PropertyEditorRegistry, org.springframework.core.convert.ConversionService, .TypeDescriptor, org.springframework.core.convert.support.ConvertingPropertyEditorAdapter, org.springframework.lang.Nullable, org.springframework.util.Assert

Abstract base class for BindingResult implementations that work with Spring's org.springframework.beans.PropertyAccessor mechanism. Pre-implements field access through delegation to the corresponding PropertyAccessor methods.
Author
Juergen Hoeller
Since
2.0
See Also
getPropertyAccessor(), org.springframework.beans.PropertyAccessor, org.springframework.beans.ConfigurablePropertyAccessor

Field Summary

Modifier and TypeField and Description
private transient ConversionService

Constructor Summary

AccessConstructor and Description
protected
AbstractPropertyBindingResult(String
the name of the target object
objectName
)

Create a new AbstractPropertyBindingResult instance.

Method Summary

Modifier and TypeMethod and Description
protected String
canonicalFieldName(String
the original field name
field
)

Overrides org.springframework.validation.AbstractErrors.canonicalFieldName.

Returns the canonical property name.
public PropertyEditor
findEditor(String
the path of the property (name or nested path), or null if looking for an editor for all properties of the given type
field
,
Class<?>
the type of the property (can be null if a property is given but should be specified in any case for consistency checking)
valueType
)

Overrides org.springframework.validation.AbstractBindingResult.findEditor.

Implements org.springframework.validation.BindingResult.findEditor.

This implementation exposes a PropertyEditor adapter for a Formatter, if applicable.
protected Object
formatFieldValue(String
the field to check
field
,
Object
the value of the field (either a rejected value other than from a binding error, or an actual field value)
value
)

Overrides org.springframework.validation.AbstractBindingResult.formatFieldValue.

Formats the field value based on registered PropertyEditors.
protected Object
getActualFieldValue(String
the field to check
field
)

Implements abstract org.springframework.validation.AbstractBindingResult.getActualFieldValue.

Fetches the field value from the PropertyAccessor.
protected PropertyEditor

Returns:

the custom PropertyEditor, or null
getCustomEditor
(String
the fully qualified field name
fixedField
)

Retrieve the custom PropertyEditor for the given field, if any.

public Class<?>
getFieldType(String
the field name
field
)

Overrides org.springframework.validation.AbstractBindingResult.getFieldType.

Overrides default org.springframework.validation.Errors.getFieldType.

Determines the field type from the property type.
public abstract ConfigurablePropertyAccessor
getPropertyAccessor()

Provide the PropertyAccessor to work with, according to the concrete strategy of access.

public PropertyEditorRegistry
public void
initConversion(ConversionService conversionService)

Inherited from org.springframework.validation.AbstractBindingResult:
addAllErrorsaddErrorequalsgetAllErrorsgetErrorCountgetFieldErrorgetFieldErrorgetFieldErrorsgetFieldErrorsgetFieldValuegetGlobalErrorgetGlobalErrorsgetMessageCodesResolvergetModelgetObjectNamegetRawFieldValuegetSuppressedFieldsgetTargethasErrorshashCoderecordFieldValuerecordSuppressedFieldrejectrejectValueresolveMessageCodesresolveMessageCodessetMessageCodesResolver

Field Detail

conversionServiceback to summary
private transient ConversionService conversionService
Annotations
@Nullable

Constructor Detail

AbstractPropertyBindingResultback to summary
protected AbstractPropertyBindingResult(String objectName)

Create a new AbstractPropertyBindingResult instance.

Parameters
objectName:String

the name of the target object

See Also
DefaultMessageCodesResolver

Method Detail

canonicalFieldNameback to summary
protected String canonicalFieldName(String field)

Overrides org.springframework.validation.AbstractErrors.canonicalFieldName.

Returns the canonical property name.

Parameters
field:String

Doc from org.springframework.validation.AbstractErrors.canonicalFieldName.

the original field name

Returns:String

Doc from org.springframework.validation.AbstractErrors.canonicalFieldName.

the canonical field name

Annotations
@Override
See Also
org.springframework.beans.PropertyAccessorUtils#canonicalPropertyName
findEditorback to summary
public PropertyEditor findEditor(String field, Class<?> valueType)

Overrides org.springframework.validation.AbstractBindingResult.findEditor.

Implements org.springframework.validation.BindingResult.findEditor.

This implementation exposes a PropertyEditor adapter for a Formatter, if applicable.

Parameters
field:String

Doc from org.springframework.validation.BindingResult.findEditor.

the path of the property (name or nested path), or null if looking for an editor for all properties of the given type

valueType:Class<?>

Doc from org.springframework.validation.BindingResult.findEditor.

the type of the property (can be null if a property is given but should be specified in any case for consistency checking)

Returns:PropertyEditor

Doc from org.springframework.validation.BindingResult.findEditor.

the registered editor, or null if none

Annotations
@Override
@Nullable
formatFieldValueback to summary
protected Object formatFieldValue(String field, Object value)

Overrides org.springframework.validation.AbstractBindingResult.formatFieldValue.

Formats the field value based on registered PropertyEditors.

Parameters
field:String

Doc from org.springframework.validation.AbstractBindingResult.formatFieldValue.

the field to check

value:Object

Doc from org.springframework.validation.AbstractBindingResult.formatFieldValue.

the value of the field (either a rejected value other than from a binding error, or an actual field value)

Returns:Object

Doc from org.springframework.validation.AbstractBindingResult.formatFieldValue.

the formatted value

Annotations
@Override
See Also
getCustomEditor
getActualFieldValueback to summary
protected Object getActualFieldValue(String field)

Implements abstract org.springframework.validation.AbstractBindingResult.getActualFieldValue.

Fetches the field value from the PropertyAccessor.

Parameters
field:String

Doc from org.springframework.validation.AbstractBindingResult.getActualFieldValue.

the field to check

Returns:Object

Doc from org.springframework.validation.AbstractBindingResult.getActualFieldValue.

the current value of the field

Annotations
@Override
@Nullable
See Also
getPropertyAccessor()
getCustomEditorback to summary
protected PropertyEditor getCustomEditor(String fixedField)

Retrieve the custom PropertyEditor for the given field, if any.

Parameters
fixedField:String

the fully qualified field name

Returns:PropertyEditor

the custom PropertyEditor, or null

Annotations
@Nullable
getFieldTypeback to summary
public Class<?> getFieldType(String field)

Overrides org.springframework.validation.AbstractBindingResult.getFieldType.

Overrides default org.springframework.validation.Errors.getFieldType.

Determines the field type from the property type.

Parameters
field:String

Doc from org.springframework.validation.Errors.getFieldType.

the field name

Returns:Class<?>

Doc from org.springframework.validation.Errors.getFieldType.

the type of the field, or null if not determinable

Annotations
@Override
@Nullable
See Also
getPropertyAccessor()
getPropertyAccessorback to summary
public abstract ConfigurablePropertyAccessor getPropertyAccessor()

Provide the PropertyAccessor to work with, according to the concrete strategy of access.

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.

See Also
ConfigurablePropertyAccessor#setExtractOldValueForEditor
getPropertyEditorRegistryback to summary
public PropertyEditorRegistry getPropertyEditorRegistry()

Overrides org.springframework.validation.AbstractBindingResult.getPropertyEditorRegistry.

Implements org.springframework.validation.BindingResult.getPropertyEditorRegistry.

Returns the underlying PropertyAccessor.

Returns:PropertyEditorRegistry

Doc from org.springframework.validation.BindingResult.getPropertyEditorRegistry.

the PropertyEditorRegistry, or null if none available for this BindingResult

Annotations
@Override
See Also
getPropertyAccessor()
initConversionback to summary
public void initConversion(ConversionService conversionService)