summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna Koskinen <Ansku@users.noreply.github.com>2019-12-04 14:38:04 +0200
committerTatu Lund <tatu@vaadin.com>2019-12-04 14:38:04 +0200
commit7895a74211c12a45e614892ce3e24fba838186fd (patch)
treef7f25bb98b69163e89875d505bc3ebfff194d0c6
parent1be20818a6db9c6d1a33e12d183421ffa054467e (diff)
downloadvaadin-framework-7895a74211c12a45e614892ce3e24fba838186fd.tar.gz
vaadin-framework-7895a74211c12a45e614892ce3e24fba838186fd.zip
Added @since tags, some tweaks to formatting. (#11839)
-rw-r--r--server/src/main/java/com/vaadin/data/BeanValidationBinder.java7
-rw-r--r--server/src/main/java/com/vaadin/data/Binder.java40
-rw-r--r--server/src/main/java/com/vaadin/server/VaadinService.java5
3 files changed, 34 insertions, 18 deletions
diff --git a/server/src/main/java/com/vaadin/data/BeanValidationBinder.java b/server/src/main/java/com/vaadin/data/BeanValidationBinder.java
index de67f922bf..44d0e1703f 100644
--- a/server/src/main/java/com/vaadin/data/BeanValidationBinder.java
+++ b/server/src/main/java/com/vaadin/data/BeanValidationBinder.java
@@ -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
diff --git a/server/src/main/java/com/vaadin/data/Binder.java b/server/src/main/java/com/vaadin/data/Binder.java
index cd7b834571..07dbf20ce4 100644
--- a/server/src/main/java/com/vaadin/data/Binder.java
+++ b/server/src/main/java/com/vaadin/data/Binder.java
@@ -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));
}
/**
diff --git a/server/src/main/java/com/vaadin/server/VaadinService.java b/server/src/main/java/com/vaadin/server/VaadinService.java
index f83441e1c3..7db1a4fd55 100644
--- a/server/src/main/java/com/vaadin/server/VaadinService.java
+++ b/server/src/main/java/com/vaadin/server/VaadinService.java
@@ -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)) {