diff options
author | Denis <denis@vaadin.com> | 2017-01-10 12:22:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-10 12:22:34 +0200 |
commit | 3ef30789d6ac773eed7346dcaa670426fa6f662c (patch) | |
tree | 2e5aee20b96e3a66088aa6cde13796256ec2bcf1 /server/src/main/java/com/vaadin/ui/declarative | |
parent | b4af93bebf1b7e51d33330c42e3c89d5e3e4fd45 (diff) | |
download | vaadin-framework-3ef30789d6ac773eed7346dcaa670426fa6f662c.tar.gz vaadin-framework-3ef30789d6ac773eed7346dcaa670426fa6f662c.zip |
Refactor AbstractDateField. (#8146)
First round for #8132.
Diffstat (limited to 'server/src/main/java/com/vaadin/ui/declarative')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java index 4c7a2da9a8..42ffe303ef 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -21,6 +21,7 @@ import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.io.Serializable; import java.lang.reflect.Method; +import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -36,6 +37,7 @@ import org.jsoup.nodes.Attributes; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; +import com.googlecode.gentyref.GenericTypeReflector; import com.vaadin.data.Converter; import com.vaadin.data.ValueContext; import com.vaadin.shared.ui.AlignmentInfo; @@ -115,8 +117,9 @@ public class DesignAttributeHandler implements Serializable { success = false; } else { // we have a value from design attributes, let's use that - Object param = getFormatter().parse(value, - setter.getParameterTypes()[0]); + Type[] types = GenericTypeReflector + .getExactParameterTypes(setter, target.getClass()); + Object param = getFormatter().parse(value, (Class<?>) types[0]); setter.invoke(target, param); success = true; } @@ -208,7 +211,9 @@ public class DesignAttributeHandler implements Serializable { Object value = getter.invoke(component); Object defaultValue = getter.invoke(defaultInstance); writeAttribute(attribute, attr, value, defaultValue, - (Class) getter.getReturnType(), context); + (Class) GenericTypeReflector.getExactReturnType(getter, + component.getClass()), + context); } catch (Exception e) { getLogger().log(Level.SEVERE, "Failed to invoke getter for attribute " + attribute, |