import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import com.vaadin.server.SerializableFunction;
import com.vaadin.server.SerializablePredicate;
import com.vaadin.util.ReflectTools;
-import java.util.Arrays;
/**
* A {@code Binder} subclass specialized for binding <em>beans</em>: classes
*
* @param <BEAN>
* the bean type
- * @param <FIELDVALUE>
- * the field value type
* @param <TARGET>
* the target property type
*/
- public interface BeanBinding<BEAN, FIELDVALUE, TARGET>
- extends Binding<BEAN, FIELDVALUE, TARGET> {
+ public interface BeanBinding<BEAN, TARGET> extends Binding<BEAN, TARGET> {
@Override
- public BeanBinding<BEAN, FIELDVALUE, TARGET> withValidator(
+ public BeanBinding<BEAN, TARGET> withValidator(
Validator<? super TARGET> validator);
@Override
- public default BeanBinding<BEAN, FIELDVALUE, TARGET> withValidator(
+ public default BeanBinding<BEAN, TARGET> withValidator(
SerializablePredicate<? super TARGET> predicate,
String message) {
- return (BeanBinding<BEAN, FIELDVALUE, TARGET>) Binding.super.withValidator(
+ return (BeanBinding<BEAN, TARGET>) Binding.super.withValidator(
predicate, message);
}
@Override
- public <NEWTARGET> BeanBinding<BEAN, FIELDVALUE, NEWTARGET> withConverter(
+ public <NEWTARGET> BeanBinding<BEAN, NEWTARGET> withConverter(
Converter<TARGET, NEWTARGET> converter);
@Override
- public default <NEWTARGET> BeanBinding<BEAN, FIELDVALUE, NEWTARGET> withConverter(
+ public default <NEWTARGET> BeanBinding<BEAN, NEWTARGET> withConverter(
SerializableFunction<TARGET, NEWTARGET> toModel,
SerializableFunction<NEWTARGET, TARGET> toPresentation) {
- return (BeanBinding<BEAN, FIELDVALUE, NEWTARGET>) Binding.super.withConverter(
+ return (BeanBinding<BEAN, NEWTARGET>) Binding.super.withConverter(
toModel, toPresentation);
}
@Override
- public default <NEWTARGET> BeanBinding<BEAN, FIELDVALUE, NEWTARGET> withConverter(
+ public default <NEWTARGET> BeanBinding<BEAN, NEWTARGET> withConverter(
SerializableFunction<TARGET, NEWTARGET> toModel,
SerializableFunction<NEWTARGET, TARGET> toPresentation,
String errorMessage) {
- return (BeanBinding<BEAN, FIELDVALUE, NEWTARGET>) Binding.super.withConverter(
+ return (BeanBinding<BEAN, NEWTARGET>) Binding.super.withConverter(
toModel, toPresentation, errorMessage);
}
*/
protected static class BeanBindingImpl<BEAN, FIELDVALUE, TARGET>
extends BindingImpl<BEAN, FIELDVALUE, TARGET>
- implements BeanBinding<BEAN, FIELDVALUE, TARGET> {
+ implements BeanBinding<BEAN, TARGET> {
private Method getter;
private Method setter;
}
@Override
- public BeanBinding<BEAN, FIELDVALUE, TARGET> withValidator(
+ public BeanBinding<BEAN, TARGET> withValidator(
Validator<? super TARGET> validator) {
- return (BeanBinding<BEAN, FIELDVALUE, TARGET>) super.withValidator(
- validator);
+ return (BeanBinding<BEAN, TARGET>) super.withValidator(validator);
}
@Override
- public <NEWTARGET> BeanBinding<BEAN, FIELDVALUE, NEWTARGET> withConverter(
+ public <NEWTARGET> BeanBinding<BEAN, NEWTARGET> withConverter(
Converter<TARGET, NEWTARGET> converter) {
- return (BeanBinding<BEAN, FIELDVALUE, NEWTARGET>) super.withConverter(
+ return (BeanBinding<BEAN, NEWTARGET>) super.withConverter(
converter);
}
public void bind(String propertyName) {
checkUnbound();
- Binding<BEAN, FIELDVALUE, Object> finalBinding;
+ Binding<BEAN, Object> finalBinding;
finalBinding = withConverter(createConverter(), false);
}
@Override
- public <FIELDVALUE> BeanBinding<BEAN, FIELDVALUE, FIELDVALUE> forField(
+ public <FIELDVALUE> BeanBinding<BEAN, FIELDVALUE> forField(
HasValue<FIELDVALUE> field) {
- return (BeanBinding<BEAN, FIELDVALUE, FIELDVALUE>) super.forField(
- field);
+ return (BeanBinding<BEAN, FIELDVALUE>) super.forField(field);
}
/**
ArrayList<Field> memberFieldInOrder = new ArrayList<>();
while (searchClass != null) {
- memberFieldInOrder.addAll(Arrays.asList(searchClass.getDeclaredFields()));
+ memberFieldInOrder
+ .addAll(Arrays.asList(searchClass.getDeclaredFields()));
searchClass = searchClass.getSuperclass();
}
return memberFieldInOrder;
*
* @param <BEAN>
* the bean type
- * @param <FIELDVALUE>
- * the value type of the field
* @param <TARGET>
* the target data type of the binding, matches the field type
* until a converter has been set
*
* @see Binder#forField(HasValue)
*/
- public interface Binding<BEAN, FIELDVALUE, TARGET> extends Serializable {
+ public interface Binding<BEAN, TARGET> extends Serializable {
/**
* Completes this binding using the given getter and setter functions
* @throws IllegalStateException
* if {@code bind} has already been called
*/
- public Binding<BEAN, FIELDVALUE, TARGET> withValidator(
+ public Binding<BEAN, TARGET> withValidator(
Validator<? super TARGET> validator);
/**
* @throws IllegalStateException
* if {@code bind} has already been called
*/
- public default Binding<BEAN, FIELDVALUE, TARGET> withValidator(
+ public default Binding<BEAN, TARGET> withValidator(
SerializablePredicate<? super TARGET> predicate,
String message) {
return withValidator(Validator.from(predicate, message));
* @throws IllegalStateException
* if {@code bind} has already been called
*/
- public default Binding<BEAN, FIELDVALUE, TARGET> withValidator(
+ public default Binding<BEAN, TARGET> withValidator(
SerializablePredicate<? super TARGET> predicate,
ErrorMessageProvider errorMessageProvider) {
return withValidator(
* @throws IllegalStateException
* if {@code bind} has already been called
*/
- public <NEWTARGET> Binding<BEAN, FIELDVALUE, NEWTARGET> withConverter(
+ public <NEWTARGET> Binding<BEAN, NEWTARGET> withConverter(
Converter<TARGET, NEWTARGET> converter);
/**
* @throws IllegalStateException
* if {@code bind} has already been called
*/
- public default <NEWTARGET> Binding<BEAN, FIELDVALUE, NEWTARGET> withConverter(
+ public default <NEWTARGET> Binding<BEAN, NEWTARGET> withConverter(
SerializableFunction<TARGET, NEWTARGET> toModel,
SerializableFunction<NEWTARGET, TARGET> toPresentation) {
return withConverter(Converter.from(toModel, toPresentation,
* @throws IllegalStateException
* if {@code bind} has already been called
*/
- public default <NEWTARGET> Binding<BEAN, FIELDVALUE, NEWTARGET> withConverter(
+ public default <NEWTARGET> Binding<BEAN, NEWTARGET> withConverter(
SerializableFunction<TARGET, NEWTARGET> toModel,
SerializableFunction<NEWTARGET, TARGET> toPresentation,
String errorMessage) {
* the value to use instead of {@code null}
* @return a new binding with null representation handling.
*/
- public default Binding<BEAN, FIELDVALUE, TARGET> withNullRepresentation(
+ public default Binding<BEAN, TARGET> withNullRepresentation(
TARGET nullRepresentation) {
return withConverter(
fieldValue -> Objects.equals(fieldValue, nullRepresentation)
*
* @return the field for the binding
*/
- public HasValue<FIELDVALUE> getField();
+ public HasValue<?> getField();
/**
* Sets the given {@code label} to show an error message if validation
* label to show validation status for the field
* @return this binding, for chaining
*/
- public default Binding<BEAN, FIELDVALUE, TARGET> withStatusLabel(
- Label label) {
+ public default Binding<BEAN, TARGET> withStatusLabel(Label label) {
return withValidationStatusHandler(status -> {
label.setValue(status.getMessage().orElse(""));
// Only show the label when validation has failed
* status change handler
* @return this binding, for chaining
*/
- public Binding<BEAN, FIELDVALUE, TARGET> withValidationStatusHandler(
+ public Binding<BEAN, TARGET> withValidationStatusHandler(
ValidationStatusHandler handler);
/**
* the error message to show for the invalid value
* @return this binding, for chaining
*/
- public default Binding<BEAN, FIELDVALUE, TARGET> setRequired(
- String errorMessage) {
+ public default Binding<BEAN, TARGET> setRequired(String errorMessage) {
return setRequired(context -> errorMessage);
}
* the provider for localized validation error message
* @return this binding, for chaining
*/
- public Binding<BEAN, FIELDVALUE, TARGET> setRequired(
+ public Binding<BEAN, TARGET> setRequired(
ErrorMessageProvider errorMessageProvider);
}
* until a converter has been set
*/
protected static class BindingImpl<BEAN, FIELDVALUE, TARGET>
- implements Binding<BEAN, FIELDVALUE, TARGET> {
+ implements Binding<BEAN, TARGET> {
private final Binder<BEAN> binder;
}
@Override
- public Binding<BEAN, FIELDVALUE, TARGET> withValidator(
+ public Binding<BEAN, TARGET> withValidator(
Validator<? super TARGET> validator) {
checkUnbound();
Objects.requireNonNull(validator, "validator cannot be null");
}
@Override
- public <NEWTARGET> Binding<BEAN, FIELDVALUE, NEWTARGET> withConverter(
+ public <NEWTARGET> Binding<BEAN, NEWTARGET> withConverter(
Converter<TARGET, NEWTARGET> converter) {
return withConverter(converter, true);
}
@Override
- public Binding<BEAN, FIELDVALUE, TARGET> withValidationStatusHandler(
+ public Binding<BEAN, TARGET> withValidationStatusHandler(
ValidationStatusHandler handler) {
checkUnbound();
Objects.requireNonNull(handler, "handler cannot be null");
}
@Override
- public Binding<BEAN, FIELDVALUE, TARGET> setRequired(
+ public Binding<BEAN, TARGET> setRequired(
ErrorMessageProvider errorMessageProvider) {
checkUnbound();
* @throws IllegalStateException
* if {@code bind} has already been called
*/
- protected <NEWTARGET> Binding<BEAN, FIELDVALUE, NEWTARGET> withConverter(
+ protected <NEWTARGET> Binding<BEAN, NEWTARGET> withConverter(
Converter<TARGET, NEWTARGET> converter,
boolean resetNullRepresentation) {
checkUnbound();
*
* @see #bind(HasValue, SerializableFunction, SerializableBiConsumer)
*/
- public <FIELDVALUE> Binding<BEAN, FIELDVALUE, FIELDVALUE> forField(
+ public <FIELDVALUE> Binding<BEAN, FIELDVALUE> forField(
HasValue<FIELDVALUE> field) {
Objects.requireNonNull(field, "field cannot be null");
// clear previous errors for this field and any bean level validation
}
// Store old bean values so we can restore them if validators fail
- Map<Binding<BEAN, ?, ?>, Object> oldValues = new HashMap<>();
+ Map<Binding<BEAN, ?>, Object> oldValues = new HashMap<>();
bindings.forEach(
binding -> oldValues.put(binding, binding.getter.apply(bean)));
* the handler to notify of status changes, not null
* @return the new incomplete binding
*/
- protected <FIELDVALUE, TARGET> Binding<BEAN, FIELDVALUE, TARGET> createBinding(
+ protected <FIELDVALUE, TARGET> Binding<BEAN, TARGET> createBinding(
HasValue<FIELDVALUE> field, Converter<FIELDVALUE, TARGET> converter,
ValidationStatusHandler handler) {
return new BindingImpl<>(this, field, converter, handler);
private final Status status;
private final ValidationResult result;
- private final Binding<?, ?, TARGET> binding;
+ private final Binding<?, TARGET> binding;
/**
* Convenience method for creating a {@link Status#UNRESOLVED} validation
* status was reset
*/
public static <TARGET> ValidationStatus<TARGET> createUnresolvedStatus(
- Binding<?, ?, TARGET> source) {
+ Binding<?, TARGET> source) {
return new ValidationStatus<>(source, Status.UNRESOLVED, null);
}
* @param result
* the result of the validation
*/
- public ValidationStatus(Binding<?, ?, TARGET> source,
+ public ValidationStatus(Binding<?, TARGET> source,
ValidationResult result) {
this(source, result.isError() ? Status.ERROR : Status.OK, result);
}
* @param result
* the related result, may be {@code null}
*/
- public ValidationStatus(Binding<?, ?, TARGET> source, Status status,
+ public ValidationStatus(Binding<?, TARGET> source, Status status,
ValidationResult result) {
Objects.requireNonNull(source, "Event source may not be null");
Objects.requireNonNull(status, "Status may not be null");
*
* @return the source binding
*/
- public Binding<?, ?, TARGET> getBinding() {
+ public Binding<?, TARGET> getBinding() {
return binding;
}
// Slider for integers between 1 and 10
Slider salaryLevelField = new Slider("Salary level", 1, 10);
- Binding<BookPerson, String, String> b1 = binder
- .forField(yearOfBirthField);
- Binding<BookPerson, String, Integer> b2 = b1.withConverter(
+ Binding<BookPerson, String> b1 = binder.forField(yearOfBirthField);
+ Binding<BookPerson, Integer> b2 = b1.withConverter(
new StringToIntegerConverter("Must enter a number"));
b2.bind(BookPerson::getYearOfBirth, BookPerson::setYearOfBirth);
- Binding<BookPerson, Double, Double> salaryBinding1 = binder
+ Binding<BookPerson, Double> salaryBinding1 = binder
.forField(salaryLevelField);
- Binding<BookPerson, Double, Integer> salaryBinding2 = salaryBinding1
+ Binding<BookPerson, Integer> salaryBinding2 = salaryBinding1
.withConverter(Double::intValue, Integer::doubleValue);
salaryBinding2.bind(BookPerson::getSalaryLevel,
BookPerson::setSalaryLevel);
DateField departing = new DateField("Departing");
DateField returning = new DateField("Returning");
- Binding<Trip, LocalDate, LocalDate> returnBinding = binder
- .forField(returning).withValidator(
+ Binding<Trip, LocalDate> returnBinding = binder.forField(returning)
+ .withValidator(
returnDate -> !returnDate
.isBefore(departing.getValue()),
"Cannot return before departing");
DateField departing = new DateField("Departing");
DateField returning = new DateField("Returning");
- Binding<Trip, LocalDate, LocalDate> returnBinding = binder
- .forField(returning).withValidator(
+ Binding<Trip, LocalDate> returnBinding = binder.forField(returning)
+ .withValidator(
returnDate -> !returnDate
.isBefore(departing.getValue()),
"Cannot return before departing");
@Test
public void bound_validatorsAreOK_noErrors() {
- Binding<Person, String, String> binding = binder.forField(nameField);
+ Binding<Person, String> binding = binder.forField(nameField);
binding.withValidator(Validator.alwaysPass()).bind(Person::getFirstName,
Person::setFirstName);
@SuppressWarnings("serial")
@Test
public void bound_validatorsFail_errors() {
- Binding<Person, String, String> binding = binder.forField(nameField);
+ Binding<Person, String> binding = binder.forField(nameField);
binding.withValidator(Validator.alwaysPass());
String msg1 = "foo";
String msg2 = "bar";
bean.setStatus("1");
Binder<StatusBean> binder = new Binder<>();
- Binding<StatusBean, String, String> binding = binder.forField(field)
+ Binding<StatusBean, String> binding = binder.forField(field)
.withConverter(presentation -> {
if (presentation.equals("OK")) {
return "1";
public void validate_failedBeanValidatorWithFieldValidator() {
String msg = "foo";
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(new NotEmptyValidator<>(msg));
binding.bind(Person::getFirstName, Person::setFirstName);
public void validate_failedBothBeanValidatorAndFieldValidator() {
String msg1 = "foo";
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(new NotEmptyValidator<>(msg1));
binding.bind(Person::getFirstName, Person::setFirstName);
@Test
public void binder_saveIfValid() {
String msg1 = "foo";
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(new NotEmptyValidator<>(msg1));
binding.bind(Person::getFirstName, Person::setFirstName);
public void save_validationErrors_exceptionContainsErrors()
throws ValidationException {
String msg = "foo";
- Binding<Person, String, String> nameBinding = binder.forField(nameField)
+ Binding<Person, String> nameBinding = binder.forField(nameField)
.withValidator(new NotEmptyValidator<>(msg));
nameBinding.bind(Person::getFirstName, Person::setFirstName);
- Binding<Person, String, Integer> ageBinding = binder.forField(ageField)
+ Binding<Person, Integer> ageBinding = binder.forField(ageField)
.withConverter(stringToInteger).withValidator(notNegative);
ageBinding.bind(Person::getAge, Person::setAge);
@Test
public void binderBindAndLoad_clearsErrors() {
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty);
binding.bind(Person::getFirstName, Person::setFirstName);
binder.withValidator(bean -> !bean.getFirstName().contains("error"),
// bind a new field that has invalid value in bean
TextField lastNameField = new TextField();
person.setLastName("");
- Binding<Person, String, String> binding2 = binder
- .forField(lastNameField).withValidator(notEmpty);
+ Binding<Person, String> binding2 = binder.forField(lastNameField)
+ .withValidator(notEmpty);
binding2.bind(Person::getLastName, Person::setLastName);
// should not have error shown
final SerializablePredicate<String> lengthPredicate = v -> v
.length() > 2;
- Binding<Person, String, String> firstNameBinding = binder
- .forField(nameField).withValidator(lengthPredicate, "length");
+ Binding<Person, String> firstNameBinding = binder.forField(nameField)
+ .withValidator(lengthPredicate, "length");
firstNameBinding.bind(Person::getFirstName, Person::setFirstName);
- Binding<Person, String, String> lastNameBinding = binder
- .forField(lastNameField)
+ Binding<Person, String> lastNameBinding = binder.forField(lastNameField)
.withValidator(v -> !nameField.getValue().isEmpty()
|| lengthPredicate.test(v), "err")
.withValidator(lengthPredicate, "length");
public void bindBinding_unbound_eventWhenBoundEndnoEventsBeforeBound() {
binder.addStatusChangeListener(this::statusChanged);
- Binding<Person, String, String> binding = binder.forField(nameField);
+ Binding<Person, String> binding = binder.forField(nameField);
nameField.setValue("");
Assert.assertNull(event.get());
@Test
public void validateBinding_noValidationErrors_statusEventWithoutErrors() {
- Binding<Person, String, String> binding = binder.forField(nameField);
+ Binding<Person, String> binding = binder.forField(nameField);
binding.bind(Person::getFirstName, Person::setFirstName);
binder.forField(ageField)
.withConverter(new StringToIntegerConverter(""))
@Test
public void validateBinding_validationErrors_statusEventWithError() {
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(name -> false, "");
binding.bind(Person::getFirstName, Person::setFirstName);
binder.forField(ageField)
TextField textField = new TextField();
Assert.assertFalse(textField.isRequiredIndicatorVisible());
- Binding<Person, String, String> binding = binder.forField(textField);
+ Binding<Person, String> binding = binder.forField(textField);
Assert.assertFalse(textField.isRequiredIndicatorVisible());
binding.setRequired("foobar");
textField.setLocale(Locale.CANADA);
Assert.assertFalse(textField.isRequiredIndicatorVisible());
- Binding<Person, String, String> binding = binder.forField(textField);
+ Binding<Person, String> binding = binder.forField(textField);
Assert.assertFalse(textField.isRequiredIndicatorVisible());
AtomicInteger invokes = new AtomicInteger();
@Test
public void bindingWithStatusHandler_handlerGetsEvents() {
AtomicReference<ValidationStatus<?>> statusCapture = new AtomicReference<>();
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty).withValidationStatusHandler(evt -> {
Assert.assertNull(statusCapture.get());
statusCapture.set(evt);
@Test
public void bindingWithStatusHandler_defaultStatusHandlerIsReplaced() {
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty).withValidationStatusHandler(evt -> {
});
binding.bind(Person::getFirstName, Person::setFirstName);
public void bindingWithStatusLabel_labelIsUpdatedAccordingStatus() {
Label label = new Label();
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty).withStatusLabel(label);
binding.bind(Person::getFirstName, Person::setFirstName);
public void bindingWithStatusLabel_defaultStatusHandlerIsReplaced() {
Label label = new Label();
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty).withStatusLabel(label);
binding.bind(Person::getFirstName, Person::setFirstName);
@Test(expected = IllegalStateException.class)
public void bindingWithStatusHandler_addAfterBound() {
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty);
binding.bind(Person::getFirstName, Person::setFirstName);
public void bindingWithStatusLabel_addAfterBound() {
Label label = new Label();
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty);
binding.bind(Person::getFirstName, Person::setFirstName);
public void bindingWithStatusLabel_setAfterHandler() {
Label label = new Label();
- Binding<Person, String, String> binding = binder.forField(nameField);
+ Binding<Person, String> binding = binder.forField(nameField);
binding.withValidationStatusHandler(NOOP);
public void bindingWithStatusHandler_setAfterLabel() {
Label label = new Label();
- Binding<Person, String, String> binding = binder.forField(nameField);
+ Binding<Person, String> binding = binder.forField(nameField);
binding.withStatusLabel(label);
@Test(expected = IllegalStateException.class)
public void bindingWithStatusHandler_setAfterOtherHandler() {
- Binding<Person, String, String> binding = binder.forField(nameField);
+ Binding<Person, String> binding = binder.forField(nameField);
binding.withValidationStatusHandler(NOOP);
@Test
public void binderWithStatusHandler_defaultStatusHandlerIsReplaced() {
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty).withValidationStatusHandler(evt -> {
});
binding.bind(Person::getFirstName, Person::setFirstName);
public void binderWithStatusLabel_defaultStatusHandlerIsReplaced() {
Label label = new Label();
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty).withStatusLabel(label);
binding.bind(Person::getFirstName, Person::setFirstName);
@Test(expected = IllegalStateException.class)
public void binderWithStatusHandler_addAfterBound() {
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty);
binding.bind(Person::getFirstName, Person::setFirstName);
public void binderWithStatusLabel_addAfterBound() {
Label label = new Label();
- Binding<Person, String, String> binding = binder.forField(nameField)
+ Binding<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty);
binding.bind(Person::getFirstName, Person::setFirstName);
public void binderWithStatusLabel_setAfterHandler() {
Label label = new Label();
- Binding<Person, String, String> binding = binder.forField(nameField);
+ Binding<Person, String> binding = binder.forField(nameField);
binding.bind(Person::getFirstName, Person::setFirstName);
binder.setValidationStatusHandler(event -> {
public void binderWithStatusHandler_setAfterLabel() {
Label label = new Label();
- Binding<Person, String, String> binding = binder.forField(nameField);
+ Binding<Person, String> binding = binder.forField(nameField);
binding.bind(Person::getFirstName, Person::setFirstName);
binder.setStatusLabel(label);
public void binderWithStatusHandler_replaceHandler() {
AtomicReference<BinderValidationStatus<?>> capture = new AtomicReference<>();
- Binding<Person, String, String> binding = binder.forField(nameField);
+ Binding<Person, String> binding = binder.forField(nameField);
binding.bind(Person::getFirstName, Person::setFirstName);
binder.setValidationStatusHandler(results -> {