Package com.vaadin.data
Class BeanValidationBinder<BEAN>
- java.lang.Object
-
- com.vaadin.data.Binder<BEAN>
-
- com.vaadin.data.BeanValidationBinder<BEAN>
-
- All Implemented Interfaces:
Serializable
public class BeanValidationBinder<BEAN> extends Binder<BEAN>
- Since:
- 8.0
- Author:
- Vaadin Ltd
- See Also:
Binder
,HasValue
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.data.Binder
Binder.Binding<BEAN,TARGET>, Binder.BindingBuilder<BEAN,TARGET>, Binder.BindingBuilderImpl<BEAN,FIELDVALUE,TARGET>, Binder.BindingImpl<BEAN,FIELDVALUE,TARGET>
-
-
Constructor Summary
Constructors Constructor Description BeanValidationBinder(Class<BEAN> beanType)
Creates a new binder that uses reflection based on the provided bean type to resolve bean properties.BeanValidationBinder(Class<BEAN> beanType, boolean scanNestedDefinitions)
Creates a new binder that uses reflection based on the provided bean type to resolve bean properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Binder.BindingBuilder<BEAN,?>
configureBinding(Binder.BindingBuilder<BEAN,?> binding, PropertyDefinition<BEAN,?> definition)
Configures thebinding
with the property definitiondefinition
before it's being bound.RequiredFieldConfigurator
getRequiredConfigurator()
Gets field required indicator configuration logic.void
setRequiredConfigurator(RequiredFieldConfigurator configurator)
Sets a logic which allows to configure require indicator viaHasValue.setRequiredIndicatorVisible(boolean)
based on property descriptor.-
Methods inherited from class com.vaadin.data.Binder
addStatusChangeListener, addValueChangeListener, bind, bind, bindInstanceFields, clearError, createBinding, doCreateBinding, forField, forMemberField, getBean, getBeanState, getBinding, getBindings, getChangedBindings, getConverterFactory, getEventRouter, getFields, getStatusLabel, getValidationStatusHandler, handleBinderValidationStatus, handleError, handleFieldValueChange, handleValidationStatus, hasChanges, hasChanges, isChangeDetectionEnabled, isValid, isValidatorsDisabled, readBean, refreshFields, removeBean, removeBinding, removeBinding, removeBinding, removeBindingInternal, restoreBeanState, setBean, setChangeDetectionEnabled, setReadOnly, setStatusLabel, setValidationStatusHandler, setValidatorsDisabled, validate, validate, withPropertySet, withValidator, withValidator, withValidator, writeBean, writeBean, writeBeanAsDraft, writeBeanAsDraft, writeBeanIfValid, writeChangedBindingsToBean
-
-
-
-
Constructor Detail
-
BeanValidationBinder
public BeanValidationBinder(Class<BEAN> beanType)
Creates a new binder that uses reflection based on the provided bean type to resolve bean properties. It assumes that JSR-303 bean validation implementation is present on the classpath. If there is no such implementation available thenBinder
class should be used instead (this constructor will throw an exception). OtherwiseBeanValidator
is added to each binding that is defined using a property name.- Parameters:
beanType
- the bean type to use, notnull
-
BeanValidationBinder
public BeanValidationBinder(Class<BEAN> beanType, boolean scanNestedDefinitions)
Creates a new binder that uses reflection based on the provided bean type to resolve bean properties. It assumes that JSR-303 bean validation implementation is present on the classpath. If there is no such implementation available thenBinder
class should be used instead (this constructor will throw an exception). OtherwiseBeanValidator
is added to each binding that is defined using a property name.- Parameters:
beanType
- the bean type to use, notnull
scanNestedDefinitions
- iftrue
, scan for nested property definitions as well- Since:
- 8.10
-
-
Method Detail
-
setRequiredConfigurator
public void setRequiredConfigurator(RequiredFieldConfigurator configurator)
Sets a logic which allows to configure require indicator viaHasValue.setRequiredIndicatorVisible(boolean)
based on property descriptor.Required indicator configuration will not be used at all if
configurator
is null.By default the
RequiredFieldConfigurator.DEFAULT
configurator is used.- Parameters:
configurator
- required indicator configurator, may benull
-
getRequiredConfigurator
public RequiredFieldConfigurator getRequiredConfigurator()
Gets field required indicator configuration logic.- Returns:
- required indicator configurator, may be
null
- See Also:
setRequiredConfigurator(RequiredFieldConfigurator)
-
configureBinding
protected Binder.BindingBuilder<BEAN,?> configureBinding(Binder.BindingBuilder<BEAN,?> binding, PropertyDefinition<BEAN,?> definition)
Description copied from class:Binder
Configures thebinding
with the property definitiondefinition
before it's being bound.- Overrides:
configureBinding
in classBinder<BEAN>
- Parameters:
binding
- a binding to configuredefinition
- a property definition information- Returns:
- the new configured binding
-
-