]> source.dussan.org Git - vaadin-framework.git/commitdiff
Use declared RPC parameter types (#8666)
authorArtur Signell <artur@vaadin.com>
Mon, 16 Apr 2012 13:35:12 +0000 (16:35 +0300)
committerArtur Signell <artur@vaadin.com>
Wed, 18 Apr 2012 20:08:54 +0000 (23:08 +0300)
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java
src/com/vaadin/ui/AbstractComponent.java

index bb6e726166eb57969b88a8144ae2af05a19544d4..ec06c28780863d505de1a7407357091fd2c9096b 100644 (file)
@@ -897,9 +897,10 @@ public abstract class AbstractCommunicationManager implements Serializable {
                 invocationJson.put(invocation.getInterfaceName());
                 invocationJson.put(invocation.getMethodName());
                 JSONArray paramJson = new JSONArray();
-                for (int i = 0; i < invocation.getParameters().length; ++i) {
+                for (int i = 0; i < invocation.getParameterTypes().length; ++i) {
                     paramJson.put(JsonCodec.encode(
-                            invocation.getParameters()[i], application));
+                            invocation.getParameters()[i],
+                            invocation.getParameterTypes()[i], application));
                 }
                 invocationJson.put(paramJson);
                 rpcCalls.put(invocationJson);
index 2edcb8a9f2cb91eef79b80d72c59c71060dcf26f..99633a13d61b6c0bd5b6dd2e99f751aada3d14f6 100644 (file)
@@ -5,6 +5,7 @@
 package com.vaadin.terminal.gwt.server;
 
 import java.io.Serializable;
+import java.lang.reflect.Method;
 
 /**
  * Internal class for keeping track of pending server to client method
@@ -18,21 +19,27 @@ public class ClientMethodInvocation implements Serializable,
     private final String interfaceName;
     private final String methodName;
     private final Object[] parameters;
+    private Class<?>[] parameterTypes;
 
-    // used for sorting calls between different Paintables in the same Root
+    // used for sorting calls between different connectors in the same Root
     private final long sequenceNumber;
     // TODO may cause problems when clustering etc.
     private static long counter = 0;
 
     public ClientMethodInvocation(ClientConnector connector,
-            String interfaceName, String methodName, Object[] parameters) {
+            String interfaceName, Method method, Object[] parameters) {
         this.connector = connector;
         this.interfaceName = interfaceName;
-        this.methodName = methodName;
+        methodName = method.getName();
+        parameterTypes = method.getParameterTypes();
         this.parameters = (null != parameters) ? parameters : new Object[0];
         sequenceNumber = ++counter;
     }
 
+    public Class<?>[] getParameterTypes() {
+        return parameterTypes;
+    }
+
     public ClientConnector getConnector() {
         return connector;
     }
index 83e6f54ad33e49f8e0fb924c37e54a4fbe3ebe13..5ef7cfd242c3ddb9ffa5f84776f756b70f5874f1 100644 (file)
@@ -1597,7 +1597,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
 
         public Object invoke(Object proxy, Method method, Object[] args)
                 throws Throwable {
-            addMethodInvocationToQueue(rpcInterfaceName, method.getName(), args);
+            addMethodInvocationToQueue(rpcInterfaceName, method, args);
             // TODO no need to do full repaint if only RPC calls
             requestRepaint();
             return null;
@@ -1618,10 +1618,10 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      * @since 7.0
      */
     protected void addMethodInvocationToQueue(String interfaceName,
-            String methodName, Object[] parameters) {
+            Method method, Object[] parameters) {
         // add to queue
         pendingInvocations.add(new ClientMethodInvocation(this, interfaceName,
-                methodName, parameters));
+                method, parameters));
     }
 
     /**