From db0ee82aee8566677b8fc4cc02eff1d40beadcd9 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 18 Jun 2009 11:03:48 +0000 Subject: MethodProperty workaround for #3064 - GAE cannot handle primitive class references svn changeset:8216/svn branch:6.0 --- src/com/vaadin/data/util/MethodProperty.java | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/com/vaadin/data/util') diff --git a/src/com/vaadin/data/util/MethodProperty.java b/src/com/vaadin/data/util/MethodProperty.java index 87915bda88..5b15b66cd5 100644 --- a/src/com/vaadin/data/util/MethodProperty.java +++ b/src/com/vaadin/data/util/MethodProperty.java @@ -11,6 +11,7 @@ import java.lang.reflect.Method; import java.util.LinkedList; import com.vaadin.data.Property; +import com.vaadin.util.SerializerHelper; /** *

@@ -78,7 +79,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier, /** * Type of the property. */ - private Class type; + private transient Class type; /** * List of listeners who are interested in the read-only status changes of @@ -95,20 +96,25 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier, /* Special serialization to handle method references */ private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.defaultWriteObject(); + SerializerHelper.writeClass(out, type); out.writeObject(instance); out.writeObject(setArgs); out.writeObject(getArgs); if (setMethod != null) { out.writeObject(setMethod.getName()); - out.writeObject(setMethod.getParameterTypes()); + SerializerHelper + .writeClassArray(out, setMethod.getParameterTypes()); } else { - out.writeObject(""); + out.writeObject(null); + out.writeObject(null); } if (getMethod != null) { out.writeObject(getMethod.getName()); - out.writeObject(getMethod.getParameterTypes()); + SerializerHelper + .writeClassArray(out, getMethod.getParameterTypes()); } else { - out.writeObject(""); + out.writeObject(null); + out.writeObject(null); } }; @@ -117,20 +123,21 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier, ClassNotFoundException { in.defaultReadObject(); try { + type = SerializerHelper.readClass(in); instance = in.readObject(); setArgs = (Object[]) in.readObject(); getArgs = (Object[]) in.readObject(); String name = (String) in.readObject(); - if (name != null && !name.equals("")) { - Class[] paramTypes = (Class[]) in.readObject(); + Class[] paramTypes = SerializerHelper.readClassArray(in); + if (name != null) { setMethod = instance.getClass().getMethod(name, paramTypes); } else { setMethod = null; } name = (String) in.readObject(); - if (name != null && !name.equals("")) { - Class[] paramTypes = (Class[]) in.readObject(); + paramTypes = SerializerHelper.readClassArray(in); + if (name != null) { getMethod = instance.getClass().getMethod(name, paramTypes); } else { getMethod = null; -- cgit v1.2.3