public abstract class

AbstractPropertyBindingResult

extends AbstractBindingResult
java.lang.Object
   ↳ org.springframework.validation.AbstractErrors
     ↳ org.springframework.validation.AbstractBindingResult
       ↳ org.springframework.validation.AbstractPropertyBindingResult
Known Direct Subclasses

Class Overview

Abstract base class for BindingResult implementations that work with Spring's PropertyAccessor mechanism. Pre-implements field access through delegation to the corresponding PropertyAccessor methods.

Summary

[Expand]
Inherited Constants
From interface org.springframework.validation.Errors
[Expand]
Inherited Fields
From interface org.springframework.validation.BindingResult
Protected Constructors
AbstractPropertyBindingResult(String objectName)
Create a new AbstractPropertyBindingResult instance.
Public Methods
PropertyEditor findEditor(String field, Class valueType)
This implementation exposes a PropertyEditor adapter for a Formatter, if applicable.
Class getFieldType(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)
Protected Methods
String canonicalFieldName(String field)
Returns the canonical property name.
Object formatFieldValue(String field, Object value)
Formats the field value based on registered PropertyEditors.
Object getActualFieldValue(String field)
Fetches the field value from the PropertyAccessor.
PropertyEditor getCustomEditor(String fixedField)
Retrieve the custom PropertyEditor for the given field, if any.
[Expand]
Inherited Methods
From class org.springframework.validation.AbstractBindingResult
From class org.springframework.validation.AbstractErrors
From class java.lang.Object
From interface org.springframework.validation.BindingResult
From interface org.springframework.validation.Errors

Protected Constructors

protected AbstractPropertyBindingResult (String objectName)

Create a new AbstractPropertyBindingResult instance.

Parameters
objectName the name of the target object

Public Methods

public PropertyEditor findEditor (String field, Class valueType)

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

Parameters
field the path of the property (name or nested path), or null if looking for an editor for all properties of the given type
valueType the type of the property (can be null if a property is given but should be specified in any case for consistency checking)
Returns
  • the registered editor, or null if none

public Class getFieldType (String field)

Determines the field type from the property type.

Parameters
field the field name
Returns
  • the type of the field, or null if not determinable

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.

public PropertyEditorRegistry getPropertyEditorRegistry ()

Returns the underlying PropertyAccessor.

Returns
  • the PropertyEditorRegistry, or null if none available for this BindingResult

public void initConversion (ConversionService conversionService)

Protected Methods

protected String canonicalFieldName (String field)

Returns the canonical property name.

Parameters
field the original field name
Returns
  • the canonical field name

protected Object formatFieldValue (String field, Object value)

Formats the field value based on registered PropertyEditors.

Parameters
field the field to check
value the value of the field (either a rejected value other than from a binding error, or an actual field value)
Returns
  • the formatted value

protected Object getActualFieldValue (String field)

Fetches the field value from the PropertyAccessor.

Parameters
field the field to check
Returns
  • the current value of the field

protected PropertyEditor getCustomEditor (String fixedField)

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

Parameters
fixedField the fully qualified field name
Returns
  • the custom PropertyEditor, or null