|
|
@@ -619,6 +619,31 @@ public class Binder<BEAN> implements Serializable { |
|
|
|
return asRequired(context -> errorMessage); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Sets the field to be required. This means two things: |
|
|
|
* <ol> |
|
|
|
* <li>the required indicator will be displayed for this field</li> |
|
|
|
* <li>the field value is validated for not being empty, i.e. that the |
|
|
|
* field's value is not equal to what {@link HasValue#getEmptyValue()} |
|
|
|
* returns</li> |
|
|
|
* </ol> |
|
|
|
* <p> |
|
|
|
* For setting an error message, use {@link #asRequired(String)}. |
|
|
|
* <p> |
|
|
|
* For localizing the error message, use |
|
|
|
* {@link #asRequired(ErrorMessageProvider)}. |
|
|
|
* |
|
|
|
* @see #asRequired(String) |
|
|
|
* @see #asRequired(ErrorMessageProvider) |
|
|
|
* @see HasValue#setRequiredIndicatorVisible(boolean) |
|
|
|
* @see HasValue#isEmpty() |
|
|
|
* @return this binding, for chaining |
|
|
|
* @since 8.2 |
|
|
|
*/ |
|
|
|
public default BindingBuilder<BEAN, TARGET> asRequired() { |
|
|
|
return asRequired(context -> ""); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Sets the field to be required. This means two things: |
|
|
|
* <ol> |