]> source.dussan.org Git - vaadin-framework.git/commitdiff
Override forSelect methods for BeanBinder to return narrowed type.
authorDenis Anisimov <denis@vaadin.com>
Mon, 19 Sep 2016 07:46:20 +0000 (10:46 +0300)
committerVaadin Code Review <review@vaadin.com>
Tue, 20 Sep 2016 06:22:17 +0000 (06:22 +0000)
Change-Id: Ib97117d8d0b450edc49309902df535361e901942

server/src/main/java/com/vaadin/data/BeanBinder.java

index 64436c26a8bd9db0aa5e30a1c576f3a23cfb0160..21aeb84735811d087ff94ca087fdc0edb03f8e9e 100644 (file)
@@ -21,12 +21,15 @@ import java.beans.PropertyDescriptor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Objects;
+import java.util.Set;
 import java.util.function.Function;
 import java.util.function.Predicate;
 
 import com.vaadin.data.util.BeanUtil;
 import com.vaadin.data.util.converter.Converter;
 import com.vaadin.data.validator.BeanValidator;
+import com.vaadin.ui.AbstractMultiSelect;
+import com.vaadin.ui.AbstractSingleSelect;
 
 /**
  * A {@code Binder} subclass specialized for binding <em>beans</em>: classes
@@ -261,6 +264,20 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
                 this::handleValidationStatus);
     }
 
+    @Override
+    public <SELECTVALUE> BeanBinding<BEAN, SELECTVALUE, SELECTVALUE> forSelect(
+            AbstractSingleSelect<SELECTVALUE> select) {
+        return (BeanBinding<BEAN, SELECTVALUE, SELECTVALUE>) super.forSelect(
+                select);
+    }
+
+    @Override
+    public <SELECTVALUE> BeanBinding<BEAN, Set<SELECTVALUE>, Set<SELECTVALUE>> forSelect(
+            AbstractMultiSelect<SELECTVALUE> select) {
+        return (BeanBinding<BEAN, Set<SELECTVALUE>, Set<SELECTVALUE>>) super.forSelect(
+                select);
+    }
+
     /**
      * Binds the given field to the property with the given name. The getter and
      * setter methods of the property are looked up with bean introspection and