summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2015-01-10 12:56:52 +0200
committerVaadin Code Review <review@vaadin.com>2015-01-12 08:46:08 +0000
commit35d91245de3218283c8f4c733a3aa72ea395fb1c (patch)
tree7b4fb520d6a733403ed9a335d0442a64cf646be6 /server
parent28dbd0c0dad3491d1f4d405e753075df983ecacc (diff)
downloadvaadin-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 'server')
-rw-r--r--server/src/com/vaadin/server/JsonCodec.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/src/com/vaadin/server/JsonCodec.java b/server/src/com/vaadin/server/JsonCodec.java
index 1f7b4ead43..ec1ea10f2b 100644
--- a/server/src/com/vaadin/server/JsonCodec.java
+++ b/server/src/com/vaadin/server/JsonCodec.java
@@ -300,7 +300,9 @@ public class JsonCodec implements Serializable {
}
// Try to decode object using fields
- if (value.getType() == JsonType.NULL) {
+ if (isJsonType(targetType)) {
+ return value;
+ } else if (value.getType() == JsonType.NULL) {
return null;
} else if (targetType == byte.class || targetType == Byte.class) {
return Byte.valueOf((byte) value.asNumber());
@@ -334,6 +336,11 @@ public class JsonCodec implements Serializable {
}
}
+ private static boolean isJsonType(Type type) {
+ return type instanceof Class<?>
+ && JsonValue.class.isAssignableFrom((Class<?>) type);
+ }
+
private static Object decodeArray(Type componentType, JsonArray value,
ConnectorTracker connectorTracker) {
Class<?> componentClass = getClassForType(componentType);