}
@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);
}
}
@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);
}
* <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);
}
/**
* the provider for localized validation error message
* @return this binding, for chaining
*/
- public BindingBuilder<BEAN, TARGET> setRequired(
+ public BindingBuilder<BEAN, TARGET> asRequired(
ErrorMessageProvider errorMessageProvider);
}
}
@Override
- public BindingBuilder<BEAN, TARGET> setRequired(
+ public BindingBuilder<BEAN, TARGET> asRequired(
ErrorMessageProvider errorMessageProvider) {
checkUnbound();
field.setRequiredIndicatorVisible(true);
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);
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";
* 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
*