summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <legioth@gmail.com>2016-12-14 14:32:07 +0200
committerAleksi Hietanen <aleksi@vaadin.com>2016-12-14 14:32:07 +0200
commitb2e3aa2acf99e98dc3e5ac3c96ec829fe3896c47 (patch)
tree43cf2062ac4f65852f51b1ad8d7b4339b7069432
parentfc011f6a8a08064f48fd5f4280f1d4d3647ab7f1 (diff)
downloadvaadin-framework-b2e3aa2acf99e98dc3e5ac3c96ec829fe3896c47.tar.gz
vaadin-framework-b2e3aa2acf99e98dc3e5ac3c96ec829fe3896c47.zip
Rename setRequired to asRequired since it's logically not a setter (#7986)
-rw-r--r--server/src/main/java/com/vaadin/data/BeanBinder.java10
-rw-r--r--server/src/main/java/com/vaadin/data/Binder.java12
-rw-r--r--server/src/test/java/com/vaadin/data/BinderTest.java4
-rw-r--r--server/src/test/java/com/vaadin/data/validator/NotEmptyValidator.java9
4 files changed, 18 insertions, 17 deletions
diff --git a/server/src/main/java/com/vaadin/data/BeanBinder.java b/server/src/main/java/com/vaadin/data/BeanBinder.java
index c04a36186a..8231c56bfc 100644
--- a/server/src/main/java/com/vaadin/data/BeanBinder.java
+++ b/server/src/main/java/com/vaadin/data/BeanBinder.java
@@ -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);
}
diff --git a/server/src/main/java/com/vaadin/data/Binder.java b/server/src/main/java/com/vaadin/data/Binder.java
index 41c07a4c08..794c6807c4 100644
--- a/server/src/main/java/com/vaadin/data/Binder.java
+++ b/server/src/main/java/com/vaadin/data/Binder.java
@@ -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);
diff --git a/server/src/test/java/com/vaadin/data/BinderTest.java b/server/src/test/java/com/vaadin/data/BinderTest.java
index 397676c062..b0d16bd9e7 100644
--- a/server/src/test/java/com/vaadin/data/BinderTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderTest.java
@@ -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";
diff --git a/server/src/test/java/com/vaadin/data/validator/NotEmptyValidator.java b/server/src/test/java/com/vaadin/data/validator/NotEmptyValidator.java
index 3a358b7097..faa37367b0 100644
--- a/server/src/test/java/com/vaadin/data/validator/NotEmptyValidator.java
+++ b/server/src/test/java/com/vaadin/data/validator/NotEmptyValidator.java
@@ -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
*