aboutsummaryrefslogtreecommitdiffstats
path: root/client-compiler
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2014-12-18 12:50:04 +0200
committerVaadin Code Review <review@vaadin.com>2014-12-18 11:45:06 +0000
commitfd62b6efe8b18d9db6db7983b722cc1db7610261 (patch)
tree4e168a9cac32968873e3f399ef11fb937ad55e4c /client-compiler
parentca62a4a1f76d2555a38dc91320949ecf09e92c35 (diff)
downloadvaadin-framework-fd62b6efe8b18d9db6db7983b722cc1db7610261.tar.gz
vaadin-framework-fd62b6efe8b18d9db6db7983b722cc1db7610261.zip
replace com.google.gwt.json.* usages with elemental.json.* (#8942)
Change-Id: I745b12685be4696fd8f1158005bf731f35ae8a81
Diffstat (limited to 'client-compiler')
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ArraySerializer.java14
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java4
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/EnumSerializer.java10
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java6
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java5
5 files changed, 20 insertions, 19 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 6ffd6c5462..0049ae9b50 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ArraySerializer.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ArraySerializer.java
@@ -19,12 +19,14 @@ package com.vaadin.server.widgetsetutils.metadata;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.typeinfo.JArrayType;
import com.google.gwt.core.ext.typeinfo.JType;
-import com.google.gwt.json.client.JSONArray;
import com.google.gwt.user.rebind.SourceWriter;
import com.vaadin.client.communication.JsonDecoder;
import com.vaadin.client.communication.JsonEncoder;
import com.vaadin.server.widgetsetutils.ConnectorBundleLoaderFactory;
+import elemental.json.Json;
+import elemental.json.JsonArray;
+
public class ArraySerializer extends JsonSerializer {
private final JArrayType arrayType;
@@ -40,12 +42,12 @@ public class ArraySerializer extends JsonSerializer {
JType leafType = arrayType.getLeafType();
int rank = arrayType.getRank();
- w.println(JSONArray.class.getName() + " jsonArray = " + jsonValue
- + ".isArray();");
+ w.println(JsonArray.class.getName() + " jsonArray = ("
+ + JsonArray.class.getName() + ")" + jsonValue + ";");
// Type value = new Type[jsonArray.size()][][];
w.print(arrayType.getQualifiedSourceName() + " value = new "
- + leafType.getQualifiedSourceName() + "[jsonArray.size()]");
+ + leafType.getQualifiedSourceName() + "[jsonArray.length()]");
for (int i = 1; i < rank; i++) {
w.print("[]");
}
@@ -75,8 +77,8 @@ public class ArraySerializer extends JsonSerializer {
String value, String applicationConnection) {
JType componentType = arrayType.getComponentType();
- w.println(JSONArray.class.getName() + " values = new "
- + JSONArray.class.getName() + "();");
+ w.println(JsonArray.class.getName() + " values = "
+ + Json.class.getName() + ".createArray();");
// JPrimitiveType primitive = componentType.isPrimitive();
w.println("for (int i = 0; i < " + value + ".length; i++) {");
w.indent();
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
index 89421dc3fb..31f59ddee4 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
@@ -37,7 +37,6 @@ import com.google.gwt.core.ext.typeinfo.JParameterizedType;
import com.google.gwt.core.ext.typeinfo.JType;
import com.google.gwt.core.ext.typeinfo.NotFoundException;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
-import com.google.gwt.json.client.JSONValue;
import com.google.gwt.thirdparty.guava.common.collect.Sets;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.ComponentConnector;
@@ -48,6 +47,7 @@ import com.vaadin.client.ui.UnknownComponentConnector;
import com.vaadin.shared.communication.ClientRpc;
import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.shared.ui.Connect;
+import elemental.json.JsonValue;
public class ConnectorBundle {
private static final String FAIL_IF_NOT_SERIALIZABLE = "vFailIfNotSerializable";
@@ -105,7 +105,7 @@ public class ConnectorBundle {
.getName());
JType[] deserializeParamTypes = new JType[] {
oracle.findType(com.vaadin.client.metadata.Type.class.getName()),
- oracle.findType(JSONValue.class.getName()),
+ oracle.findType(JsonValue.class.getName()),
oracle.findType(ApplicationConnection.class.getName()) };
String deserializeMethodName = "deserialize";
// Just test that the method exists
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/EnumSerializer.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/EnumSerializer.java
index 18e9652ed1..9876baf946 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/EnumSerializer.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/EnumSerializer.java
@@ -19,9 +19,10 @@ package com.vaadin.server.widgetsetutils.metadata;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.typeinfo.JEnumConstant;
import com.google.gwt.core.ext.typeinfo.JEnumType;
-import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.rebind.SourceWriter;
+import elemental.json.Json;
+
public class EnumSerializer extends JsonSerializer {
private final JEnumType enumType;
@@ -34,8 +35,7 @@ public class EnumSerializer extends JsonSerializer {
@Override
protected void printDeserializerBody(TreeLogger logger, SourceWriter w,
String type, String jsonValue, String connection) {
- w.println("String enumIdentifier = ((" + JSONString.class.getName()
- + ")" + jsonValue + ").stringValue();");
+ w.println("String enumIdentifier = " + jsonValue + ".asString();");
for (JEnumConstant e : enumType.getEnumConstants()) {
w.println("if (\"" + e.getName() + "\".equals(enumIdentifier)) {");
w.indent();
@@ -50,8 +50,8 @@ public class EnumSerializer extends JsonSerializer {
@Override
protected void printSerializerBody(TreeLogger logger, SourceWriter w,
String value, String applicationConnection) {
- // return new JSONString(castedValue.name());
- w.println("return new " + JSONString.class.getName() + "(" + value
+ // return Json.create(castedValue.name());
+ w.println("return " + Json.class.getName() + ".create(" + value
+ ".name());");
}
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java
index 0509689850..a7a6c568da 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java
@@ -19,10 +19,10 @@ package com.vaadin.server.widgetsetutils.metadata;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JType;
-import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.rebind.SourceWriter;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.communication.JSONSerializer;
+import elemental.json.JsonValue;
public abstract class JsonSerializer implements GeneratedSerializer {
@@ -51,7 +51,7 @@ public abstract class JsonSerializer implements GeneratedSerializer {
protected void writeSerializerBody(TreeLogger logger, SourceWriter w) {
String qualifiedSourceName = type.getQualifiedSourceName();
- w.println("public " + JSONValue.class.getName() + " serialize("
+ w.println("public " + JsonValue.class.getName() + " serialize("
+ qualifiedSourceName + " value, "
+ ApplicationConnection.class.getName() + " connection) {");
w.indent();
@@ -69,7 +69,7 @@ public abstract class JsonSerializer implements GeneratedSerializer {
// T deserialize(Type type, JSONValue jsonValue, ApplicationConnection
// connection);
w.println("public " + qualifiedSourceName + " deserialize(Type type, "
- + JSONValue.class.getName() + " jsonValue, "
+ + JsonValue.class.getName() + " jsonValue, "
+ ApplicationConnection.class.getName() + " connection) {");
w.indent();
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java
index 85236efccc..bf1e11c9e3 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java
@@ -31,9 +31,8 @@ import com.vaadin.client.connectors.AbstractRendererConnector;
* {@link AbstractRendererConnector#getRenderer() getRenderer} method to enable
* automatic creation of an instance of the proper renderer type.
* <li>Stores the presentation type of the connector to enable the
- * {@link AbstractRendererConnector#decode(com.google.gwt.json.client.JSONValue)
- * decode} method to work without having to implement a "getPresentationType"
- * method.
+ * {@link AbstractRendererConnector#decode(elemental.json.JsonValue) decode}
+ * method to work without having to implement a "getPresentationType" method.
* </ul>
*
* @see WidgetInitVisitor