aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-04-16 16:35:12 +0300
committerArtur Signell <artur@vaadin.com>2012-04-18 23:08:54 +0300
commit5ad6dbae66d22e887ccdc4e31dde1781fc5255e6 (patch)
tree591b1e0b2ec544a13acb525118f9cfcb73280066
parent0d95a362d9ee1a163affbbefb820ecdf75f21da0 (diff)
downloadvaadin-framework-5ad6dbae66d22e887ccdc4e31dde1781fc5255e6.tar.gz
vaadin-framework-5ad6dbae66d22e887ccdc4e31dde1781fc5255e6.zip
Use declared RPC parameter types (#8666)
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java5
-rw-r--r--src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java13
-rw-r--r--src/com/vaadin/ui/AbstractComponent.java6
3 files changed, 16 insertions, 8 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
index bb6e726166..ec06c28780 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
@@ -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);
diff --git a/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java b/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java
index 2edcb8a9f2..99633a13d6 100644
--- a/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java
+++ b/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java
@@ -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;
}
diff --git a/src/com/vaadin/ui/AbstractComponent.java b/src/com/vaadin/ui/AbstractComponent.java
index 83e6f54ad3..5ef7cfd242 100644
--- a/src/com/vaadin/ui/AbstractComponent.java
+++ b/src/com/vaadin/ui/AbstractComponent.java
@@ -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));
}
/**