Annotation Interface AbstractFieldBuilder.Binding

Enclosing class:
AbstractFieldBuilder<S extends AbstractFieldBuilder<S,T>,T>

@Retention(RUNTIME) @Target(METHOD) @Documented public static @interface AbstractFieldBuilder.Binding
Specifies properties of the Binder binding itself.

Properties correspond to methods in Binder.BindingBuilder.

Note: When it comes to Converters, Validators, and nullRepresentation(), the order in which these items are added to the binding matters. These items are chained together in sequence between the field and the model.

For example, the standard Binder.BindingBuilder methods such as withConverter() always add new items to the "model" side of the chain, so that (for example) each Converter added will take as its "presentation" value the previous Converter's "model" value.

This annotation builds the binding by applying its configuration in the following order, going from the field's presentation value to the data bean's model value:

  1. Implicit validation by ValidatingFields
  2. requiredValidator(), requiredProvider(), or required()
  3. nullRepresentation()
  4. converter()
  5. validators() (in the order given)
  6. postValidationConverter()

Therefore, each item in the list should assume all previous items in list have already "seen" the field's value. In particular, if both a converter() and one or more validators() are configured, then the Validators will validate the converted model values, not the presentation values.

To get the reverse behavior, i.e., to validate presentation values instead of model values, configure the Converter using postValidationConverter() instead of converter().

See Also: