summaryrefslogtreecommitdiffstats
path: root/client-compiler
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-12-18 15:07:21 +0200
committerVaadin Code Review <review@vaadin.com>2012-12-18 13:35:12 +0000
commita6ffd484283353825470988bf2d13093685d2761 (patch)
tree4beab888aac6ecf37a318d2eb68f1dd433acbf1e /client-compiler
parentca967cbe1d927d7acf5cb72683265557e0b46360 (diff)
downloadvaadin-framework-a6ffd484283353825470988bf2d13093685d2761.tar.gz
vaadin-framework-a6ffd484283353825470988bf2d13093685d2761.zip
Encode all values based on declared type (#10549)
* ServerRpc encoding uses type data from the interface * Beans encoded on the server use reflection based on declared type * Remove row numbers to enable adding test without changing old indices * Update test to send non-primitive map values Change-Id: I0462b547cb7de252564b3569420b0b24cee4515f
Diffstat (limited to 'client-compiler')
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ArraySerializer.java7
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java1
2 files changed, 6 insertions, 2 deletions
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ArraySerializer.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ArraySerializer.java
index 4ab5cccb2e..7b326c65fc 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ArraySerializer.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ArraySerializer.java
@@ -73,14 +73,17 @@ public class ArraySerializer extends JsonSerializer {
@Override
protected void printSerializerBody(TreeLogger logger, SourceWriter w,
String value, String applicationConnection) {
+ JType componentType = arrayType.getComponentType();
+
w.println(JSONArray.class.getName() + " values = new "
+ JSONArray.class.getName() + "();");
// JPrimitiveType primitive = componentType.isPrimitive();
w.println("for (int i = 0; i < " + value + ".length; i++) {");
w.indent();
w.print("values.set(i, ");
- w.print(JsonEncoder.class.getName() + ".encode(" + value
- + "[i], false, " + applicationConnection + ")");
+ w.print(JsonEncoder.class.getName() + ".encode(" + value + "[i],");
+ ConnectorBundleLoaderFactory.writeTypeCreator(w, componentType);
+ w.print(", " + applicationConnection + ")");
w.println(");");
w.outdent();
w.println("}");
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java
index fa0a8390a4..e14e8234d5 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java
@@ -38,6 +38,7 @@ public class ServerRpcVisitor extends TypeVisitor {
for (JMethod method : methods) {
ClientRpcVisitor.checkReturnType(logger, method);
bundle.setNeedsDelayedInfo(type, method);
+ bundle.setNeedsParamTypes(subType, method);
JType[] parameterTypes = method.getParameterTypes();
for (JType paramType : parameterTypes) {