]> source.dussan.org Git - vaadin-framework.git/commitdiff
Rename SerializableBiConsumer into Setter
authorIlia Motornyi <elmot@vaadin.com>
Thu, 15 Dec 2016 11:45:08 +0000 (13:45 +0200)
committerGitHub <noreply@github.com>
Thu, 15 Dec 2016 11:45:08 +0000 (13:45 +0200)
server/src/main/java/com/vaadin/data/BeanBinder.java
server/src/main/java/com/vaadin/data/Binder.java
server/src/main/java/com/vaadin/data/StatusChangeEvent.java
server/src/main/java/com/vaadin/server/SerializableBiConsumer.java [deleted file]
server/src/main/java/com/vaadin/server/Setter.java [new file with mode: 0644]

index 56219ff6bf6820df40c0b683bc1089e6ec837c44..07bc40b1dd325c0e0f4da7db2841cbd594d5b911 100644 (file)
@@ -36,7 +36,7 @@ import com.googlecode.gentyref.GenericTypeReflector;
 import com.vaadin.annotations.PropertyId;
 import com.vaadin.data.util.BeanUtil;
 import com.vaadin.data.validator.BeanValidator;
-import com.vaadin.server.SerializableBiConsumer;
+import com.vaadin.server.Setter;
 import com.vaadin.server.SerializableFunction;
 import com.vaadin.server.SerializablePredicate;
 import com.vaadin.ui.Label;
@@ -161,7 +161,7 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
          *             if the property has no accessible getter
          *
          * @see BindingBuilder#bind(ValueProvider,
-         *      SerializableBiConsumer)
+         *      Setter)
          */
         public Binding<BEAN, TARGET> bind(String propertyName);
     }
@@ -361,7 +361,7 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
      * @throws IllegalArgumentException
      *             if the property has no accessible getter
      *
-     * @see #bind(HasValue, ValueProvider, SerializableBiConsumer)
+     * @see #bind(HasValue, ValueProvider, Setter)
      */
     public <FIELDVALUE> Binding<BEAN, FIELDVALUE> bind(
             HasValue<FIELDVALUE> field, String propertyName) {
index 9f496d04d26b5c31720e857e990617122849d917..94a16d9da969919142bddd82edbaf90d9c2f4297 100644 (file)
@@ -34,7 +34,7 @@ import com.vaadin.data.HasValue.ValueChangeEvent;
 import com.vaadin.data.converter.StringToIntegerConverter;
 import com.vaadin.event.EventRouter;
 import com.vaadin.server.ErrorMessage;
-import com.vaadin.server.SerializableBiConsumer;
+import com.vaadin.server.Setter;
 import com.vaadin.server.SerializableFunction;
 import com.vaadin.server.SerializablePredicate;
 import com.vaadin.server.UserError;
@@ -173,7 +173,7 @@ public class Binder<BEAN> implements Serializable {
          */
         public Binding<BEAN, TARGET> bind(
                 ValueProvider<BEAN, TARGET> getter,
-                com.vaadin.server.SerializableBiConsumer<BEAN, TARGET> setter);
+                Setter<BEAN, TARGET> setter);
 
         /**
          * Adds a validator to this binding. Validators are applied, in
@@ -255,7 +255,7 @@ public class Binder<BEAN> implements Serializable {
          * which must match the current target data type of the binding, and a
          * model type, which can be any data type and becomes the new target
          * type of the binding. When invoking
-         * {@link #bind(ValueProvider, SerializableBiConsumer)}, the
+         * {@link #bind(ValueProvider, Setter)}, the
          * target type of the binding must match the getter/setter types.
          * <p>
          * For instance, a {@code TextField} can be bound to an integer-typed
@@ -281,7 +281,7 @@ public class Binder<BEAN> implements Serializable {
          * type, which must match the current target data type of the binding,
          * and a model type, which can be any data type and becomes the new
          * target type of the binding. When invoking
-         * {@link #bind(ValueProvider, SerializableBiConsumer)}, the
+         * {@link #bind(ValueProvider, Setter)}, the
          * target type of the binding must match the getter/setter types.
          * <p>
          * For instance, a {@code TextField} can be bound to an integer-typed
@@ -316,7 +316,7 @@ public class Binder<BEAN> implements Serializable {
          * type, which must match the current target data type of the binding,
          * and a model type, which can be any data type and becomes the new
          * target type of the binding. When invoking
-         * {@link #bind(ValueProvider, SerializableBiConsumer)}, the
+         * {@link #bind(ValueProvider, Setter)}, the
          * target type of the binding must match the getter/setter types.
          * <p>
          * For instance, a {@code TextField} can be bound to an integer-typed
@@ -534,7 +534,7 @@ public class Binder<BEAN> implements Serializable {
         @Override
         public Binding<BEAN, TARGET> bind(
                 ValueProvider<BEAN, TARGET> getter,
-                SerializableBiConsumer<BEAN, TARGET> setter) {
+                Setter<BEAN, TARGET> setter) {
             checkUnbound();
             Objects.requireNonNull(getter, "getter cannot be null");
 
@@ -673,7 +673,7 @@ public class Binder<BEAN> implements Serializable {
         private final BindingValidationStatusHandler statusHandler;
 
         private final SerializableFunction<BEAN, TARGET> getter;
-        private final SerializableBiConsumer<BEAN, TARGET> setter;
+        private final Setter<BEAN, TARGET> setter;
 
         // Not final since we temporarily remove listener while changing values
         private Registration onValueChange;
@@ -686,7 +686,7 @@ public class Binder<BEAN> implements Serializable {
 
         public BindingImpl(BindingBuilderImpl<BEAN, FIELDVALUE, TARGET> builder,
                 SerializableFunction<BEAN, TARGET> getter,
-                SerializableBiConsumer<BEAN, TARGET> setter) {
+                Setter<BEAN, TARGET> setter) {
             this.binder = builder.getBinder();
             this.field = builder.field;
             this.statusHandler = builder.statusHandler;
@@ -976,7 +976,7 @@ public class Binder<BEAN> implements Serializable {
     /**
      * Creates a new binding for the given field. The returned builder may be
      * further configured before invoking
-     * {@link BindingBuilder#bind(ValueProvider, SerializableBiConsumer)}
+     * {@link BindingBuilder#bind(ValueProvider, Setter)}
      * which completes the binding. Until {@code Binding.bind} is called, the
      * binding has no effect.
      * <p>
@@ -993,7 +993,7 @@ public class Binder<BEAN> implements Serializable {
      *            the field to be bound, not null
      * @return the new binding
      *
-     * @see #bind(HasValue, ValueProvider, SerializableBiConsumer)
+     * @see #bind(HasValue, ValueProvider, Setter)
      */
     public <FIELDVALUE> BindingBuilder<BEAN, FIELDVALUE> forField(
             HasValue<FIELDVALUE> field) {
@@ -1061,7 +1061,7 @@ public class Binder<BEAN> implements Serializable {
     public <FIELDVALUE> Binding<BEAN, FIELDVALUE> bind(
             HasValue<FIELDVALUE> field,
             ValueProvider<BEAN, FIELDVALUE> getter,
-            SerializableBiConsumer<BEAN, FIELDVALUE> setter) {
+            Setter<BEAN, FIELDVALUE> setter) {
         return forField(field).bind(getter, setter);
     }
 
@@ -1473,7 +1473,7 @@ public class Binder<BEAN> implements Serializable {
      * <li>{@link #setBean(Object)} is called
      * <li>{@link #removeBean()} is called
      * <li>
-     * {@link BindingBuilder#bind(ValueProvider, SerializableBiConsumer)}
+     * {@link BindingBuilder#bind(ValueProvider, Setter)}
      * is called
      * <li>{@link Binder#validate()} or {@link Binding#validate()} is called
      * </ul>
index 2c4e87d897734339265a6205593dbe02da222d50..42f92e654cb81020cedc38590f82ddb168433d1e 100644 (file)
@@ -19,7 +19,7 @@ import java.util.EventObject;
 
 import com.vaadin.data.Binder.Binding;
 import com.vaadin.data.Binder.BindingBuilder;
-import com.vaadin.server.SerializableBiConsumer;
+import com.vaadin.server.Setter;
 
 /**
  * Binder status change event.
@@ -32,7 +32,7 @@ import com.vaadin.server.SerializableBiConsumer;
  * <li>{@link Binder#readBean(Object)} is called
  * <li>{@link Binder#setBean(Object)} is called
  * <li>{@link Binder#removeBean()} is called
- * <li>{@link BindingBuilder#bind(ValueProvider, SerializableBiConsumer)}
+ * <li>{@link BindingBuilder#bind(ValueProvider, Setter)}
  * is called
  * <li>{@link Binder#validate()} or {@link Binding#validate()} is called
  * </ul>
diff --git a/server/src/main/java/com/vaadin/server/SerializableBiConsumer.java b/server/src/main/java/com/vaadin/server/SerializableBiConsumer.java
deleted file mode 100644 (file)
index 278d53f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2000-2016 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.server;
-
-import java.io.Serializable;
-import java.util.function.BiConsumer;
-
-/**
- * A {@link BiConsumer} that is also {@link Serializable}.
- * 
- * @see BiConsumer
- * @param <T>
- *            the type of the first argument to the operation
- * @param <U>
- *            the type of the second argument to the operation
- * 
- * @since 8.0
- * @author Vaadin Ltd
- *
- */
-@FunctionalInterface
-public interface SerializableBiConsumer<T, U>
-        extends BiConsumer<T, U>, Serializable {
-    // Only method inherited from BiConsumer
-}
diff --git a/server/src/main/java/com/vaadin/server/Setter.java b/server/src/main/java/com/vaadin/server/Setter.java
new file mode 100644 (file)
index 0000000..87eb9ec
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.server;
+
+import com.vaadin.data.Binder;
+import com.vaadin.data.HasValue;
+
+import java.io.Serializable;
+import java.util.function.BiConsumer;
+
+/**
+ * The function to write the field value to the bean property
+ * 
+ * @see BiConsumer
+ * @see Binder#bind(HasValue, SerializableFunction, Setter)
+ * @param <BEAN>
+ *            the type of the target bean
+ * @param <FIELDVALUE>
+ *            the field value type to be written to the bean
+ * 
+ * @since 8.0
+ * @author Vaadin Ltd
+ *
+ */
+@FunctionalInterface
+public interface Setter<BEAN, FIELDVALUE>
+        extends BiConsumer<BEAN, FIELDVALUE>, Serializable {
+
+    /** Save value to the bean property
+     *
+     * @param bean
+     *          the target bean
+     * @param fieldvalue
+     *          the field value to be written to the bean
+     */
+    @Override
+    void accept(BEAN bean, FIELDVALUE fieldvalue);
+}