diff options
author | Leif Åstrand <leif@vaadin.com> | 2015-01-10 12:56:52 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-01-12 08:46:08 +0000 |
commit | 35d91245de3218283c8f4c733a3aa72ea395fb1c (patch) | |
tree | 7b4fb520d6a733403ed9a335d0442a64cf646be6 /client-compiler | |
parent | 28dbd0c0dad3491d1f4d405e753075df983ecacc (diff) | |
download | vaadin-framework-35d91245de3218283c8f4c733a3aa72ea395fb1c.tar.gz vaadin-framework-35d91245de3218283c8f4c733a3aa72ea395fb1c.zip |
Support JsonValue types as declared types in state and RPC (#15560)
Change-Id: I2779a533811bb1b60c4e74789f6378574bc6ac61
Diffstat (limited to 'client-compiler')
-rw-r--r-- | client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java index 13bd7051f6..f946d87638 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java @@ -47,6 +47,7 @@ import com.google.gwt.user.rebind.SourceWriter; import com.vaadin.client.JsArrayObject; import com.vaadin.client.ServerConnector; import com.vaadin.client.annotations.OnStateChange; +import com.vaadin.client.communication.JsonDecoder; import com.vaadin.client.metadata.ConnectorBundleLoader; import com.vaadin.client.metadata.ConnectorBundleLoader.CValUiInfo; import com.vaadin.client.metadata.InvokationHandler; @@ -1011,7 +1012,16 @@ public class ConnectorBundleLoaderFactory extends Generator { w.print(", "); } String parameterTypeName = getBoxedTypeName(parameterType); - w.print("(" + parameterTypeName + ") params[" + i + "]"); + + if (parameterTypeName.startsWith("elemental.json.Json")) { + // Need to pass through native method to allow casting Object to + // JSO if the value is a string + w.print("%s.<%s>obj2jso(params[%d])", + JsonDecoder.class.getCanonicalName(), + parameterTypeName, i); + } else { + w.print("(" + parameterTypeName + ") params[" + i + "]"); + } } w.println(");"); |