From: Leif Åstrand Date: Mon, 28 Nov 2016 09:08:38 +0000 (+0200) Subject: Simplify Binding API by removing the FIELDTYPE type parameter X-Git-Tag: 8.0.0.alpha8~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3fd7537c14e63e7558acfa553f9996c6cfc323d6;p=vaadin-framework.git Simplify Binding API by removing the FIELDTYPE type parameter The type parameter is mainly used internally, the only externally facing use is to define the exact type of Binding.getField. Code that has access to a typed instance of Binding does typically also have direct access to the field instance, so there's no real use for the type parameter. Change-Id: Idf2ab18a79ec5f0a7cef83705b8084fbf7014c10 --- diff --git a/server/src/main/java/com/vaadin/data/BeanBinder.java b/server/src/main/java/com/vaadin/data/BeanBinder.java index a2307a5161..8bc207ae56 100644 --- a/server/src/main/java/com/vaadin/data/BeanBinder.java +++ b/server/src/main/java/com/vaadin/data/BeanBinder.java @@ -23,6 +23,7 @@ import java.lang.reflect.InvocationTargetException; 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; @@ -40,7 +41,6 @@ import com.vaadin.server.SerializableBiConsumer; 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 beans: classes @@ -62,44 +62,41 @@ public class BeanBinder extends Binder { * * @param * the bean type - * @param - * the field value type * @param * the target property type */ - public interface BeanBinding - extends Binding { + public interface BeanBinding extends Binding { @Override - public BeanBinding withValidator( + public BeanBinding withValidator( Validator validator); @Override - public default BeanBinding withValidator( + public default BeanBinding withValidator( SerializablePredicate predicate, String message) { - return (BeanBinding) Binding.super.withValidator( + return (BeanBinding) Binding.super.withValidator( predicate, message); } @Override - public BeanBinding withConverter( + public BeanBinding withConverter( Converter converter); @Override - public default BeanBinding withConverter( + public default BeanBinding withConverter( SerializableFunction toModel, SerializableFunction toPresentation) { - return (BeanBinding) Binding.super.withConverter( + return (BeanBinding) Binding.super.withConverter( toModel, toPresentation); } @Override - public default BeanBinding withConverter( + public default BeanBinding withConverter( SerializableFunction toModel, SerializableFunction toPresentation, String errorMessage) { - return (BeanBinding) Binding.super.withConverter( + return (BeanBinding) Binding.super.withConverter( toModel, toPresentation, errorMessage); } @@ -141,7 +138,7 @@ public class BeanBinder extends Binder { */ protected static class BeanBindingImpl extends BindingImpl - implements BeanBinding { + implements BeanBinding { private Method getter; private Method setter; @@ -166,16 +163,15 @@ public class BeanBinder extends Binder { } @Override - public BeanBinding withValidator( + public BeanBinding withValidator( Validator validator) { - return (BeanBinding) super.withValidator( - validator); + return (BeanBinding) super.withValidator(validator); } @Override - public BeanBinding withConverter( + public BeanBinding withConverter( Converter converter) { - return (BeanBinding) super.withConverter( + return (BeanBinding) super.withConverter( converter); } @@ -183,7 +179,7 @@ public class BeanBinder extends Binder { public void bind(String propertyName) { checkUnbound(); - Binding finalBinding; + Binding finalBinding; finalBinding = withConverter(createConverter(), false); @@ -281,10 +277,9 @@ public class BeanBinder extends Binder { } @Override - public BeanBinding forField( + public BeanBinding forField( HasValue field) { - return (BeanBinding) super.forField( - field); + return (BeanBinding) super.forField(field); } /** @@ -481,7 +476,8 @@ public class BeanBinder extends Binder { ArrayList memberFieldInOrder = new ArrayList<>(); while (searchClass != null) { - memberFieldInOrder.addAll(Arrays.asList(searchClass.getDeclaredFields())); + memberFieldInOrder + .addAll(Arrays.asList(searchClass.getDeclaredFields())); searchClass = searchClass.getSuperclass(); } return memberFieldInOrder; diff --git a/server/src/main/java/com/vaadin/data/Binder.java b/server/src/main/java/com/vaadin/data/Binder.java index df6d72d79c..65e791931d 100644 --- a/server/src/main/java/com/vaadin/data/Binder.java +++ b/server/src/main/java/com/vaadin/data/Binder.java @@ -92,15 +92,13 @@ public class Binder implements Serializable { * * @param * the bean type - * @param - * the value type of the field * @param * the target data type of the binding, matches the field type * until a converter has been set * * @see Binder#forField(HasValue) */ - public interface Binding extends Serializable { + public interface Binding extends Serializable { /** * Completes this binding using the given getter and setter functions @@ -159,7 +157,7 @@ public class Binder implements Serializable { * @throws IllegalStateException * if {@code bind} has already been called */ - public Binding withValidator( + public Binding withValidator( Validator validator); /** @@ -182,7 +180,7 @@ public class Binder implements Serializable { * @throws IllegalStateException * if {@code bind} has already been called */ - public default Binding withValidator( + public default Binding withValidator( SerializablePredicate predicate, String message) { return withValidator(Validator.from(predicate, message)); @@ -209,7 +207,7 @@ public class Binder implements Serializable { * @throws IllegalStateException * if {@code bind} has already been called */ - public default Binding withValidator( + public default Binding withValidator( SerializablePredicate predicate, ErrorMessageProvider errorMessageProvider) { return withValidator( @@ -239,7 +237,7 @@ public class Binder implements Serializable { * @throws IllegalStateException * if {@code bind} has already been called */ - public Binding withConverter( + public Binding withConverter( Converter converter); /** @@ -269,7 +267,7 @@ public class Binder implements Serializable { * @throws IllegalStateException * if {@code bind} has already been called */ - public default Binding withConverter( + public default Binding withConverter( SerializableFunction toModel, SerializableFunction toPresentation) { return withConverter(Converter.from(toModel, toPresentation, @@ -307,7 +305,7 @@ public class Binder implements Serializable { * @throws IllegalStateException * if {@code bind} has already been called */ - public default Binding withConverter( + public default Binding withConverter( SerializableFunction toModel, SerializableFunction toPresentation, String errorMessage) { @@ -323,7 +321,7 @@ public class Binder implements Serializable { * the value to use instead of {@code null} * @return a new binding with null representation handling. */ - public default Binding withNullRepresentation( + public default Binding withNullRepresentation( TARGET nullRepresentation) { return withConverter( fieldValue -> Objects.equals(fieldValue, nullRepresentation) @@ -337,7 +335,7 @@ public class Binder implements Serializable { * * @return the field for the binding */ - public HasValue getField(); + public HasValue getField(); /** * Sets the given {@code label} to show an error message if validation @@ -371,8 +369,7 @@ public class Binder implements Serializable { * label to show validation status for the field * @return this binding, for chaining */ - public default Binding withStatusLabel( - Label label) { + public default Binding withStatusLabel(Label label) { return withValidationStatusHandler(status -> { label.setValue(status.getMessage().orElse("")); // Only show the label when validation has failed @@ -409,7 +406,7 @@ public class Binder implements Serializable { * status change handler * @return this binding, for chaining */ - public Binding withValidationStatusHandler( + public Binding withValidationStatusHandler( ValidationStatusHandler handler); /** @@ -442,8 +439,7 @@ public class Binder implements Serializable { * the error message to show for the invalid value * @return this binding, for chaining */ - public default Binding setRequired( - String errorMessage) { + public default Binding setRequired(String errorMessage) { return setRequired(context -> errorMessage); } @@ -462,7 +458,7 @@ public class Binder implements Serializable { * the provider for localized validation error message * @return this binding, for chaining */ - public Binding setRequired( + public Binding setRequired( ErrorMessageProvider errorMessageProvider); } @@ -478,7 +474,7 @@ public class Binder implements Serializable { * until a converter has been set */ protected static class BindingImpl - implements Binding { + implements Binding { private final Binder binder; @@ -534,7 +530,7 @@ public class Binder implements Serializable { } @Override - public Binding withValidator( + public Binding withValidator( Validator validator) { checkUnbound(); Objects.requireNonNull(validator, "validator cannot be null"); @@ -545,13 +541,13 @@ public class Binder implements Serializable { } @Override - public Binding withConverter( + public Binding withConverter( Converter converter) { return withConverter(converter, true); } @Override - public Binding withValidationStatusHandler( + public Binding withValidationStatusHandler( ValidationStatusHandler handler) { checkUnbound(); Objects.requireNonNull(handler, "handler cannot be null"); @@ -566,7 +562,7 @@ public class Binder implements Serializable { } @Override - public Binding setRequired( + public Binding setRequired( ErrorMessageProvider errorMessageProvider) { checkUnbound(); @@ -601,7 +597,7 @@ public class Binder implements Serializable { * @throws IllegalStateException * if {@code bind} has already been called */ - protected Binding withConverter( + protected Binding withConverter( Converter converter, boolean resetNullRepresentation) { checkUnbound(); @@ -920,7 +916,7 @@ public class Binder implements Serializable { * * @see #bind(HasValue, SerializableFunction, SerializableBiConsumer) */ - public Binding forField( + public Binding forField( HasValue field) { Objects.requireNonNull(field, "field cannot be null"); // clear previous errors for this field and any bean level validation @@ -1139,7 +1135,7 @@ public class Binder implements Serializable { } // Store old bean values so we can restore them if validators fail - Map, Object> oldValues = new HashMap<>(); + Map, Object> oldValues = new HashMap<>(); bindings.forEach( binding -> oldValues.put(binding, binding.getter.apply(bean))); @@ -1435,7 +1431,7 @@ public class Binder implements Serializable { * the handler to notify of status changes, not null * @return the new incomplete binding */ - protected Binding createBinding( + protected Binding createBinding( HasValue field, Converter converter, ValidationStatusHandler handler) { return new BindingImpl<>(this, field, converter, handler); diff --git a/server/src/main/java/com/vaadin/data/ValidationStatus.java b/server/src/main/java/com/vaadin/data/ValidationStatus.java index 66e34eb6dd..bbc4326b60 100644 --- a/server/src/main/java/com/vaadin/data/ValidationStatus.java +++ b/server/src/main/java/com/vaadin/data/ValidationStatus.java @@ -69,7 +69,7 @@ public class ValidationStatus implements Serializable { private final Status status; private final ValidationResult result; - private final Binding binding; + private final Binding binding; /** * Convenience method for creating a {@link Status#UNRESOLVED} validation @@ -83,7 +83,7 @@ public class ValidationStatus implements Serializable { * status was reset */ public static ValidationStatus createUnresolvedStatus( - Binding source) { + Binding source) { return new ValidationStatus<>(source, Status.UNRESOLVED, null); } @@ -96,7 +96,7 @@ public class ValidationStatus implements Serializable { * @param result * the result of the validation */ - public ValidationStatus(Binding source, + public ValidationStatus(Binding source, ValidationResult result) { this(source, result.isError() ? Status.ERROR : Status.OK, result); } @@ -114,7 +114,7 @@ public class ValidationStatus implements Serializable { * @param result * the related result, may be {@code null} */ - public ValidationStatus(Binding source, Status status, + public ValidationStatus(Binding source, Status status, ValidationResult result) { Objects.requireNonNull(source, "Event source may not be null"); Objects.requireNonNull(status, "Status may not be null"); @@ -177,7 +177,7 @@ public class ValidationStatus implements Serializable { * * @return the source binding */ - public Binding getBinding() { + public Binding getBinding() { return binding; } diff --git a/server/src/test/java/com/vaadin/data/BinderBookOfVaadinTest.java b/server/src/test/java/com/vaadin/data/BinderBookOfVaadinTest.java index 14a6be0307..5aafc475ef 100644 --- a/server/src/test/java/com/vaadin/data/BinderBookOfVaadinTest.java +++ b/server/src/test/java/com/vaadin/data/BinderBookOfVaadinTest.java @@ -249,15 +249,14 @@ public class BinderBookOfVaadinTest { // Slider for integers between 1 and 10 Slider salaryLevelField = new Slider("Salary level", 1, 10); - Binding b1 = binder - .forField(yearOfBirthField); - Binding b2 = b1.withConverter( + Binding b1 = binder.forField(yearOfBirthField); + Binding b2 = b1.withConverter( new StringToIntegerConverter("Must enter a number")); b2.bind(BookPerson::getYearOfBirth, BookPerson::setYearOfBirth); - Binding salaryBinding1 = binder + Binding salaryBinding1 = binder .forField(salaryLevelField); - Binding salaryBinding2 = salaryBinding1 + Binding salaryBinding2 = salaryBinding1 .withConverter(Double::intValue, Integer::doubleValue); salaryBinding2.bind(BookPerson::getSalaryLevel, BookPerson::setSalaryLevel); @@ -305,8 +304,8 @@ public class BinderBookOfVaadinTest { DateField departing = new DateField("Departing"); DateField returning = new DateField("Returning"); - Binding returnBinding = binder - .forField(returning).withValidator( + Binding returnBinding = binder.forField(returning) + .withValidator( returnDate -> !returnDate .isBefore(departing.getValue()), "Cannot return before departing"); @@ -358,8 +357,8 @@ public class BinderBookOfVaadinTest { DateField departing = new DateField("Departing"); DateField returning = new DateField("Returning"); - Binding returnBinding = binder - .forField(returning).withValidator( + Binding returnBinding = binder.forField(returning) + .withValidator( returnDate -> !returnDate .isBefore(departing.getValue()), "Cannot return before departing"); diff --git a/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java b/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java index b3d6d62c0b..9ad8dca2c3 100644 --- a/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java +++ b/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java @@ -73,7 +73,7 @@ public class BinderConverterValidatorTest @Test public void bound_validatorsAreOK_noErrors() { - Binding binding = binder.forField(nameField); + Binding binding = binder.forField(nameField); binding.withValidator(Validator.alwaysPass()).bind(Person::getFirstName, Person::setFirstName); @@ -87,7 +87,7 @@ public class BinderConverterValidatorTest @SuppressWarnings("serial") @Test public void bound_validatorsFail_errors() { - Binding binding = binder.forField(nameField); + Binding binding = binder.forField(nameField); binding.withValidator(Validator.alwaysPass()); String msg1 = "foo"; String msg2 = "bar"; @@ -221,7 +221,7 @@ public class BinderConverterValidatorTest bean.setStatus("1"); Binder binder = new Binder<>(); - Binding binding = binder.forField(field) + Binding binding = binder.forField(field) .withConverter(presentation -> { if (presentation.equals("OK")) { return "1"; @@ -266,7 +266,7 @@ public class BinderConverterValidatorTest public void validate_failedBeanValidatorWithFieldValidator() { String msg = "foo"; - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(new NotEmptyValidator<>(msg)); binding.bind(Person::getFirstName, Person::setFirstName); @@ -286,7 +286,7 @@ public class BinderConverterValidatorTest public void validate_failedBothBeanValidatorAndFieldValidator() { String msg1 = "foo"; - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(new NotEmptyValidator<>(msg1)); binding.bind(Person::getFirstName, Person::setFirstName); @@ -322,7 +322,7 @@ public class BinderConverterValidatorTest @Test public void binder_saveIfValid() { String msg1 = "foo"; - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(new NotEmptyValidator<>(msg1)); binding.bind(Person::getFirstName, Person::setFirstName); @@ -554,11 +554,11 @@ public class BinderConverterValidatorTest public void save_validationErrors_exceptionContainsErrors() throws ValidationException { String msg = "foo"; - Binding nameBinding = binder.forField(nameField) + Binding nameBinding = binder.forField(nameField) .withValidator(new NotEmptyValidator<>(msg)); nameBinding.bind(Person::getFirstName, Person::setFirstName); - Binding ageBinding = binder.forField(ageField) + Binding ageBinding = binder.forField(ageField) .withConverter(stringToInteger).withValidator(notNegative); ageBinding.bind(Person::getAge, Person::setAge); @@ -585,7 +585,7 @@ public class BinderConverterValidatorTest @Test public void binderBindAndLoad_clearsErrors() { - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty); binding.bind(Person::getFirstName, Person::setFirstName); binder.withValidator(bean -> !bean.getFirstName().contains("error"), @@ -621,8 +621,8 @@ public class BinderConverterValidatorTest // bind a new field that has invalid value in bean TextField lastNameField = new TextField(); person.setLastName(""); - Binding binding2 = binder - .forField(lastNameField).withValidator(notEmpty); + Binding binding2 = binder.forField(lastNameField) + .withValidator(notEmpty); binding2.bind(Person::getLastName, Person::setLastName); // should not have error shown @@ -663,12 +663,11 @@ public class BinderConverterValidatorTest final SerializablePredicate lengthPredicate = v -> v .length() > 2; - Binding firstNameBinding = binder - .forField(nameField).withValidator(lengthPredicate, "length"); + Binding firstNameBinding = binder.forField(nameField) + .withValidator(lengthPredicate, "length"); firstNameBinding.bind(Person::getFirstName, Person::setFirstName); - Binding lastNameBinding = binder - .forField(lastNameField) + Binding lastNameBinding = binder.forField(lastNameField) .withValidator(v -> !nameField.getValue().isEmpty() || lengthPredicate.test(v), "err") .withValidator(lengthPredicate, "length"); diff --git a/server/src/test/java/com/vaadin/data/BinderStatusChangeTest.java b/server/src/test/java/com/vaadin/data/BinderStatusChangeTest.java index 1e03a22fd7..e453e68482 100644 --- a/server/src/test/java/com/vaadin/data/BinderStatusChangeTest.java +++ b/server/src/test/java/com/vaadin/data/BinderStatusChangeTest.java @@ -45,7 +45,7 @@ public class BinderStatusChangeTest public void bindBinding_unbound_eventWhenBoundEndnoEventsBeforeBound() { binder.addStatusChangeListener(this::statusChanged); - Binding binding = binder.forField(nameField); + Binding binding = binder.forField(nameField); nameField.setValue(""); Assert.assertNull(event.get()); @@ -377,7 +377,7 @@ public class BinderStatusChangeTest @Test public void validateBinding_noValidationErrors_statusEventWithoutErrors() { - Binding binding = binder.forField(nameField); + Binding binding = binder.forField(nameField); binding.bind(Person::getFirstName, Person::setFirstName); binder.forField(ageField) .withConverter(new StringToIntegerConverter("")) @@ -393,7 +393,7 @@ public class BinderStatusChangeTest @Test public void validateBinding_validationErrors_statusEventWithError() { - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(name -> false, ""); binding.bind(Person::getFirstName, Person::setFirstName); binder.forField(ageField) diff --git a/server/src/test/java/com/vaadin/data/BinderTest.java b/server/src/test/java/com/vaadin/data/BinderTest.java index 0ad86b9f19..7f2353a448 100644 --- a/server/src/test/java/com/vaadin/data/BinderTest.java +++ b/server/src/test/java/com/vaadin/data/BinderTest.java @@ -331,7 +331,7 @@ public class BinderTest extends BinderTestBase, Person> { TextField textField = new TextField(); Assert.assertFalse(textField.isRequiredIndicatorVisible()); - Binding binding = binder.forField(textField); + Binding binding = binder.forField(textField); Assert.assertFalse(textField.isRequiredIndicatorVisible()); binding.setRequired("foobar"); @@ -357,7 +357,7 @@ public class BinderTest extends BinderTestBase, Person> { textField.setLocale(Locale.CANADA); Assert.assertFalse(textField.isRequiredIndicatorVisible()); - Binding binding = binder.forField(textField); + Binding binding = binder.forField(textField); Assert.assertFalse(textField.isRequiredIndicatorVisible()); AtomicInteger invokes = new AtomicInteger(); diff --git a/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java b/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java index 6cef908aef..d901ee00d8 100644 --- a/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java +++ b/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java @@ -48,7 +48,7 @@ public class BinderValidationStatusTest @Test public void bindingWithStatusHandler_handlerGetsEvents() { AtomicReference> statusCapture = new AtomicReference<>(); - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty).withValidationStatusHandler(evt -> { Assert.assertNull(statusCapture.get()); statusCapture.set(evt); @@ -84,7 +84,7 @@ public class BinderValidationStatusTest @Test public void bindingWithStatusHandler_defaultStatusHandlerIsReplaced() { - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty).withValidationStatusHandler(evt -> { }); binding.bind(Person::getFirstName, Person::setFirstName); @@ -105,7 +105,7 @@ public class BinderValidationStatusTest public void bindingWithStatusLabel_labelIsUpdatedAccordingStatus() { Label label = new Label(); - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty).withStatusLabel(label); binding.bind(Person::getFirstName, Person::setFirstName); @@ -132,7 +132,7 @@ public class BinderValidationStatusTest public void bindingWithStatusLabel_defaultStatusHandlerIsReplaced() { Label label = new Label(); - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty).withStatusLabel(label); binding.bind(Person::getFirstName, Person::setFirstName); @@ -150,7 +150,7 @@ public class BinderValidationStatusTest @Test(expected = IllegalStateException.class) public void bindingWithStatusHandler_addAfterBound() { - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty); binding.bind(Person::getFirstName, Person::setFirstName); @@ -161,7 +161,7 @@ public class BinderValidationStatusTest public void bindingWithStatusLabel_addAfterBound() { Label label = new Label(); - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty); binding.bind(Person::getFirstName, Person::setFirstName); @@ -172,7 +172,7 @@ public class BinderValidationStatusTest public void bindingWithStatusLabel_setAfterHandler() { Label label = new Label(); - Binding binding = binder.forField(nameField); + Binding binding = binder.forField(nameField); binding.withValidationStatusHandler(NOOP); @@ -183,7 +183,7 @@ public class BinderValidationStatusTest public void bindingWithStatusHandler_setAfterLabel() { Label label = new Label(); - Binding binding = binder.forField(nameField); + Binding binding = binder.forField(nameField); binding.withStatusLabel(label); @@ -193,7 +193,7 @@ public class BinderValidationStatusTest @Test(expected = IllegalStateException.class) public void bindingWithStatusHandler_setAfterOtherHandler() { - Binding binding = binder.forField(nameField); + Binding binding = binder.forField(nameField); binding.withValidationStatusHandler(NOOP); @@ -392,7 +392,7 @@ public class BinderValidationStatusTest @Test public void binderWithStatusHandler_defaultStatusHandlerIsReplaced() { - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty).withValidationStatusHandler(evt -> { }); binding.bind(Person::getFirstName, Person::setFirstName); @@ -413,7 +413,7 @@ public class BinderValidationStatusTest public void binderWithStatusLabel_defaultStatusHandlerIsReplaced() { Label label = new Label(); - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty).withStatusLabel(label); binding.bind(Person::getFirstName, Person::setFirstName); @@ -431,7 +431,7 @@ public class BinderValidationStatusTest @Test(expected = IllegalStateException.class) public void binderWithStatusHandler_addAfterBound() { - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty); binding.bind(Person::getFirstName, Person::setFirstName); @@ -442,7 +442,7 @@ public class BinderValidationStatusTest public void binderWithStatusLabel_addAfterBound() { Label label = new Label(); - Binding binding = binder.forField(nameField) + Binding binding = binder.forField(nameField) .withValidator(notEmpty); binding.bind(Person::getFirstName, Person::setFirstName); @@ -453,7 +453,7 @@ public class BinderValidationStatusTest public void binderWithStatusLabel_setAfterHandler() { Label label = new Label(); - Binding binding = binder.forField(nameField); + Binding binding = binder.forField(nameField); binding.bind(Person::getFirstName, Person::setFirstName); binder.setValidationStatusHandler(event -> { @@ -466,7 +466,7 @@ public class BinderValidationStatusTest public void binderWithStatusHandler_setAfterLabel() { Label label = new Label(); - Binding binding = binder.forField(nameField); + Binding binding = binder.forField(nameField); binding.bind(Person::getFirstName, Person::setFirstName); binder.setStatusLabel(label); @@ -484,7 +484,7 @@ public class BinderValidationStatusTest public void binderWithStatusHandler_replaceHandler() { AtomicReference> capture = new AtomicReference<>(); - Binding binding = binder.forField(nameField); + Binding binding = binder.forField(nameField); binding.bind(Person::getFirstName, Person::setFirstName); binder.setValidationStatusHandler(results -> {