]> source.dussan.org Git - vaadin-framework.git/commitdiff
Rename setRequired to asRequired since it's logically not a setter (#7986)
authorLeif Åstrand <legioth@gmail.com>
Wed, 14 Dec 2016 12:32:07 +0000 (14:32 +0200)
committerAleksi Hietanen <aleksi@vaadin.com>
Wed, 14 Dec 2016 12:32:07 +0000 (14:32 +0200)
server/src/main/java/com/vaadin/data/BeanBinder.java
server/src/main/java/com/vaadin/data/Binder.java
server/src/test/java/com/vaadin/data/BinderTest.java
server/src/test/java/com/vaadin/data/validator/NotEmptyValidator.java

index c04a36186a01b733e8b018473167f348a2f59b45..8231c56bfccb2603685f7da6eb5eeb453bc9338e 100644 (file)
@@ -97,13 +97,13 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
         }
 
         @Override
-        public BeanBindingBuilder<BEAN, TARGET> setRequired(
+        public BeanBindingBuilder<BEAN, TARGET> asRequired(
                 ErrorMessageProvider errorMessageProvider);
 
         @Override
-        public default BeanBindingBuilder<BEAN, TARGET> setRequired(
+        public default BeanBindingBuilder<BEAN, TARGET> asRequired(
                 String errorMessage) {
-            return (BeanBindingBuilder<BEAN, TARGET>) BindingBuilder.super.setRequired(
+            return (BeanBindingBuilder<BEAN, TARGET>) BindingBuilder.super.asRequired(
                     errorMessage);
         }
 
@@ -222,9 +222,9 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
         }
 
         @Override
-        public BeanBindingBuilder<BEAN, TARGET> setRequired(
+        public BeanBindingBuilder<BEAN, TARGET> asRequired(
                 ErrorMessageProvider errorMessageProvider) {
-            return (BeanBindingBuilder<BEAN, TARGET>) super.setRequired(
+            return (BeanBindingBuilder<BEAN, TARGET>) super.asRequired(
                     errorMessageProvider);
         }
 
index 41c07a4c0826e14c929643efc53f6a404d0e1ea0..794c6807c4c5b3ce083c4ad0e996ea351af233c9 100644 (file)
@@ -445,21 +445,21 @@ public class Binder<BEAN> implements Serializable {
          * <li>the field value is validated for not being empty*</li>
          * </ol>
          * For localizing the error message, use
-         * {@link #setRequired(SerializableFunction)}.
+         * {@link #asRequired(ErrorMessageProvider)}.
          * <p>
          * *Value not being the equal to what {@link HasValue#getEmptyValue()}
          * returns.
          *
-         * @see #setRequired(SerializableFunction)
+         * @see #asRequired(ErrorMessageProvider)
          * @see HasValue#setRequiredIndicatorVisible(boolean)
          * @see HasValue#isEmpty()
          * @param errorMessage
          *            the error message to show for the invalid value
          * @return this binding, for chaining
          */
-        public default BindingBuilder<BEAN, TARGET> setRequired(
+        public default BindingBuilder<BEAN, TARGET> asRequired(
                 String errorMessage) {
-            return setRequired(context -> errorMessage);
+            return asRequired(context -> errorMessage);
         }
 
         /**
@@ -477,7 +477,7 @@ public class Binder<BEAN> implements Serializable {
          *            the provider for localized validation error message
          * @return this binding, for chaining
          */
-        public BindingBuilder<BEAN, TARGET> setRequired(
+        public BindingBuilder<BEAN, TARGET> asRequired(
                 ErrorMessageProvider errorMessageProvider);
     }
 
@@ -587,7 +587,7 @@ public class Binder<BEAN> implements Serializable {
         }
 
         @Override
-        public BindingBuilder<BEAN, TARGET> setRequired(
+        public BindingBuilder<BEAN, TARGET> asRequired(
                 ErrorMessageProvider errorMessageProvider) {
             checkUnbound();
             field.setRequiredIndicatorVisible(true);
index 397676c062481ed98088d6ffa31fde288b7bbe83..b0d16bd9e753c5d4ad9fa14f72f43c088c39649f 100644 (file)
@@ -334,7 +334,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
         BindingBuilder<Person, String> binding = binder.forField(textField);
         Assert.assertFalse(textField.isRequiredIndicatorVisible());
 
-        binding.setRequired("foobar");
+        binding.asRequired("foobar");
         Assert.assertTrue(textField.isRequiredIndicatorVisible());
 
         binding.bind(Person::getFirstName, Person::setFirstName);
@@ -361,7 +361,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
         Assert.assertFalse(textField.isRequiredIndicatorVisible());
         AtomicInteger invokes = new AtomicInteger();
 
-        binding.setRequired(context -> {
+        binding.asRequired(context -> {
             invokes.incrementAndGet();
             Assert.assertSame(Locale.CANADA, context.getLocale().get());
             return "foobar";
index 3a358b7097b6e7f77d1de5802bbcd41810dc5721..faa37367b082acc352c1d8e6f55e0534c2cc9096 100644 (file)
@@ -33,13 +33,14 @@ import com.vaadin.data.util.converter.ValueContext;
  * This validator can be suitable for fields that have been marked as required
  * with {@link HasValue#setRequiredIndicatorVisible(boolean)}.
  * <p>
- * Note that {@link BindingBuilder#setRequired(com.vaadin.data.ErrorMessageProvider)}
- * does almost the same thing, but verifies against the value NOT being equal to
- * what {@link HasValue#getEmptyValue()} returns and sets the required indicator
+ * Note that
+ * {@link BindingBuilder#asRequired(com.vaadin.data.ErrorMessageProvider)} does
+ * almost the same thing, but verifies against the value NOT being equal to what
+ * {@link HasValue#getEmptyValue()} returns and sets the required indicator
  * visible with {@link HasValue#setRequiredIndicatorVisible(boolean)}.
  *
  * @see HasValue#setRequiredIndicatorVisible(boolean)
- * @see BindingBuilder#setRequired(com.vaadin.data.ErrorMessageProvider)
+ * @see BindingBuilder#asRequired(com.vaadin.data.ErrorMessageProvider)
  * @author Vaadin Ltd
  * @since 8.0
  *