summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-06-05 15:56:53 +0300
committerLeif Åstrand <leif@vaadin.com>2012-06-06 13:33:55 +0300
commitc284b3c3881b23cd0275a5adad055dd2aa3c3252 (patch)
tree71d76d6cff766bc7358fddfd96659ee89a73e163 /src
parente88a49764e1a797089f65566e77482c6cc585c91 (diff)
downloadvaadin-framework-c284b3c3881b23cd0275a5adad055dd2aa3c3252.tar.gz
vaadin-framework-c284b3c3881b23cd0275a5adad055dd2aa3c3252.zip
Use update from deserialize instead of generating the same code again
Also slightly improve indenting in generated code
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java
index 6e1ebdfc7f..060d0fa96a 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java
@@ -157,7 +157,7 @@ public class SerializerGenerator extends Generator {
+ ApplicationConnection.class.getName() + " connection) {");
sourceWriter.indent();
- writeBeanDeserializer(logger, sourceWriter, beanType, true);
+ writeBeanDeserializer(logger, sourceWriter, beanType);
sourceWriter.outdent();
sourceWriter.println("}");
@@ -175,14 +175,20 @@ public class SerializerGenerator extends Generator {
if (isEnum) {
writeEnumDeserializer(logger, sourceWriter, beanType.isEnum());
} else {
- writeBeanDeserializer(logger, sourceWriter, beanType, false);
+ sourceWriter.println(beanQualifiedSourceName
+ + " target = GWT.create(" + beanQualifiedSourceName
+ + ".class);");
+ sourceWriter
+ .println("update(target, type, jsonValue, connection);");
+ // return target;
+ sourceWriter.println("return target;");
}
- sourceWriter.println("}");
sourceWriter.outdent();
+ sourceWriter.println("}");
// End of class
- sourceWriter.println("}");
sourceWriter.outdent();
+ sourceWriter.println("}");
// commit generated class
context.commit(logger, printWriter);
@@ -207,15 +213,9 @@ public class SerializerGenerator extends Generator {
}
private void writeBeanDeserializer(TreeLogger logger,
- SourceWriter sourceWriter, JClassType beanType, boolean update) {
+ SourceWriter sourceWriter, JClassType beanType) {
String beanQualifiedSourceName = beanType.getQualifiedSourceName();
- if (!update) {
- sourceWriter.println(beanQualifiedSourceName
- + " target = GWT.create(" + beanQualifiedSourceName
- + ".class);");
- }
-
// JSONOBject json = (JSONObject)jsonValue;
sourceWriter.println(JSONObject.class.getName() + " json = ("
+ JSONObject.class.getName() + ")jsonValue;");
@@ -268,12 +268,6 @@ public class SerializerGenerator extends Generator {
sourceWriter.outdent();
sourceWriter.println("}");
}
-
- if (!update) {
- // return target;
- sourceWriter.println("return target;");
- }
-
}
private void writeEnumSerializer(TreeLogger logger,