Annotation Interface AbstractFieldBuilder.NullifyCheckbox
- Enclosing class:
- AbstractFieldBuilder<S extends AbstractFieldBuilder<S,
T>, T>
@Retention(RUNTIME)
@Target(METHOD)
@Documented
public static @interface AbstractFieldBuilder.NullifyCheckbox
Causes the field that would otherwise be used for a property to be wrapped in a
NullableField
,
which adds a Checkbox
that controls whether the value is null or not.
For example:
// This is one of our data model classes
public class FoodItem {
// This field is mandatory
@FieldBuilder.TextField
@NotNull
public String getName() { ... }
// This field is optional
@FieldBuilder.NullifyCheckbox("This item expires on:")
@FieldBuilder.DatePicker
public LocalDate getExpirationDate() { ... }
}
- See Also:
-
Required Element Summary
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
Whether theNullableField
itself should display error messages.boolean
Whether the value of the inner field should be automatically reset to its empty value when theCheckbox
is unchecked.
-
Element Details
-
-
resetOnDisable
boolean resetOnDisableWhether the value of the inner field should be automatically reset to its empty value when theCheckbox
is unchecked.- Returns:
- whether to reset when disabled
- See Also:
- Default:
- true
-
displayErrorMessages
boolean displayErrorMessagesWhether theNullableField
itself should display error messages.If the inner field is a complex field with sub-fields, such that any validation errors will have originated from a sub-field which is already displaying the error, then setting this to false can reduce clutter.
- Returns:
- whether to reset when disabled
- See Also:
- Default:
- true
-