]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added @since tags, some tweaks to formatting. (#11839)
authorAnna Koskinen <Ansku@users.noreply.github.com>
Wed, 4 Dec 2019 12:38:04 +0000 (14:38 +0200)
committerTatu Lund <tatu@vaadin.com>
Wed, 4 Dec 2019 12:38:04 +0000 (14:38 +0200)
server/src/main/java/com/vaadin/data/BeanValidationBinder.java
server/src/main/java/com/vaadin/data/Binder.java
server/src/main/java/com/vaadin/server/VaadinService.java

index de67f922bf4fd6394475ddd82aa3d55006e05201..44d0e1703fa7c93c0e8fcfbde397bb5be29bd7b9 100644 (file)
@@ -49,7 +49,7 @@ public class BeanValidationBinder<BEAN> extends Binder<BEAN> {
      *            the bean type to use, not <code>null</code>
      */
     public BeanValidationBinder(Class<BEAN> beanType) {
-        this(beanType,false);
+        this(beanType, false);
     }
 
     /**
@@ -65,8 +65,11 @@ public class BeanValidationBinder<BEAN> extends Binder<BEAN> {
      *            the bean type to use, not {@code null}
      * @param scanNestedDefinitions
      *            if {@code true}, scan for nested property definitions as well
+     * 
+     * @since 8.10
      */
-    public BeanValidationBinder(Class<BEAN> beanType, boolean scanNestedDefinitions) {
+    public BeanValidationBinder(Class<BEAN> beanType,
+            boolean scanNestedDefinitions) {
         super(beanType, scanNestedDefinitions);
         if (!BeanUtil.checkBeanValidationAvailable()) {
             throw new IllegalStateException(BeanValidationBinder.class
index cd7b834571b1442b35740f5ece71ad252a982dbd..07dbf20ce4b2cf4fa09e0d07a0e19e90674d3ddd 100644 (file)
@@ -228,26 +228,30 @@ public class Binder<BEAN> implements Serializable {
         public Setter<BEAN, TARGET> getSetter();
 
         /**
-         * Enable or disable asRequired validator.
-         * The validator is enabled by default.
+         * Enable or disable asRequired validator. The validator is enabled by
+         * default.
          *
          * @see #asRequired(String)
          * @see #asRequired(ErrorMessageProvider)
          *
          * @param asRequiredEnabled
-         *            {@code false} if asRequired validator should
-         *            be disabled, {@code true} otherwise (default)
+         *            {@code false} if asRequired validator should be disabled,
+         *            {@code true} otherwise (default)
+         *
+         * @since 8.10
          */
         public void setAsRequiredEnabled(boolean asRequiredEnabled);
 
         /**
-         * Returns whether asRequired validator is currently enabled or not
+         * Returns whether asRequired validator is currently enabled or not.
          *
          * @see #asRequired(String)
          * @see #asRequired(ErrorMessageProvider)
          *
          * @return {@code false} if asRequired validator is disabled
          *         {@code true} otherwise (default)
+         *
+         * @since 8.10
          */
         public boolean isAsRequiredEnabled();
     }
@@ -946,10 +950,11 @@ public class Binder<BEAN> implements Serializable {
             this.asRequiredSet = true;
             field.setRequiredIndicatorVisible(true);
             return withValidator((value, context) -> {
-                if (!field.isRequiredIndicatorVisible())
+                if (!field.isRequiredIndicatorVisible()) {
                     return ValidationResult.ok();
-                else
+                } else {
                     return customRequiredValidator.apply(value, context);
+                }
             });
         }
 
@@ -1281,7 +1286,8 @@ public class Binder<BEAN> implements Serializable {
                  * field doesn't accept null rather than throwing for some other
                  * reason.
                  */
-                if (convertedValue == null && getField().getEmptyValue() != null) {
+                if (convertedValue == null
+                        && getField().getEmptyValue() != null) {
                     throw new IllegalStateException(String.format(
                             "A field of type %s didn't accept a null value."
                                     + " If null values are expected, then configure a null representation for the binding.",
@@ -1322,12 +1328,12 @@ public class Binder<BEAN> implements Serializable {
         public void setAsRequiredEnabled(boolean asRequiredEnabled) {
             if (!asRequiredSet) {
                 throw new IllegalStateException(
-                 "Unable to toggle asRequired validation since " 
-                         + "asRequired has not been set.");
+                        "Unable to toggle asRequired validation since "
+                                + "asRequired has not been set.");
             }
             if (asRequiredEnabled != isAsRequiredEnabled()) {
                 field.setRequiredIndicatorVisible(asRequiredEnabled);
-                        validate();
+                validate();
             }
         }
 
@@ -1732,7 +1738,7 @@ public class Binder<BEAN> implements Serializable {
      * <p>
      * After updating each field, the value is read back from the field and the
      * bean's property value is updated if it has been changed from the original
-     * value by the field or a converter.     
+     * value by the field or a converter.
      *
      * @see #readBean(Object)
      * @see #writeBean(Object)
@@ -1799,8 +1805,9 @@ public class Binder<BEAN> implements Serializable {
                 // avoid NPE inside initFieldValue. It happens e.g. when
                 // we unbind a binding in valueChangeListener of another
                 // field.
-                if (binding.getField() != null)
+                if (binding.getField() != null) {
                     binding.initFieldValue(bean, false);
+                }
             });
             getValidationStatusHandler().statusChange(
                     BinderValidationStatus.createUnresolvedStatus(this));
@@ -1851,6 +1858,8 @@ public class Binder<BEAN> implements Serializable {
      * @param bean
      *            the object to which to write the field values, not
      *            {@code null}
+     *
+     * @since 8.10
      */
     public void writeBeanAsDraft(BEAN bean) {
         doWriteDraft(bean, new ArrayList<>(bindings));
@@ -1953,11 +1962,12 @@ public class Binder<BEAN> implements Serializable {
      *            the set of bindings to write to the bean
      */
     @SuppressWarnings({ "unchecked" })
-    private void doWriteDraft(BEAN bean, Collection<Binding<BEAN, ?>> bindings) {
+    private void doWriteDraft(BEAN bean,
+            Collection<Binding<BEAN, ?>> bindings) {
         Objects.requireNonNull(bean, "bean cannot be null");
 
         bindings.forEach(binding -> ((BindingImpl<BEAN, ?, ?>) binding)
-                    .writeFieldValue(bean));
+                .writeFieldValue(bean));
     }
 
     /**
index f83441e1c364aae796a36a528604a9544f006c01..7db1a4fd5511c9ac2590e6d996847e51bdc01835 100644 (file)
@@ -202,7 +202,7 @@ public abstract class VaadinService implements Serializable {
      * @since 8.2
      */
     protected VaadinService() {
-        this.deploymentConfiguration = null;
+        deploymentConfiguration = null;
     }
 
     /**
@@ -1232,6 +1232,9 @@ public abstract class VaadinService implements Serializable {
      * default called at the end of each request, after sending the response.
      *
      * @param session
+     *            the session to clean up
+     *
+     * @since 8.10
      */
     public void cleanupSession(VaadinSession session) {
         if (isSessionActive(session)) {