org.springframework.validation

Class AbstractPropertyBindingResult

    • Constructor Detail

      • AbstractPropertyBindingResult

        protected AbstractPropertyBindingResult(java.lang.String objectName)
        Create a new AbstractPropertyBindingResult instance.
        Parameters:
        objectName - the name of the target object
        See Also:
        DefaultMessageCodesResolver
    • Method Detail

      • formatFieldValue

        protected java.lang.Object formatFieldValue(java.lang.String field,
                                                    @Nullable
                                                    java.lang.Object value)
        Formats the field value based on registered PropertyEditors.
        Overrides:
        formatFieldValue in class AbstractBindingResult
        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
        See Also:
        getCustomEditor(java.lang.String)
      • getCustomEditor

        @Nullable
        protected java.beans.PropertyEditor getCustomEditor(java.lang.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
      • findEditor

        @Nullable
        public java.beans.PropertyEditor findEditor(@Nullable
                                                              java.lang.String field,
                                                              @Nullable
                                                              java.lang.Class<?> valueType)
        This implementation exposes a PropertyEditor adapter for a Formatter, if applicable.
        Specified by:
        findEditor in interface BindingResult
        Overrides:
        findEditor in class AbstractBindingResult
        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
      • getPropertyAccessor

        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(boolean)