aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Carrasco Moñino <manolo@apache.org>2014-12-23 16:09:13 +0100
committerManuel Carrasco Moñino <manolo@apache.org>2014-12-23 16:09:13 +0100
commit45138b470ae618dbe986dc75bdbadae6ffbe991f (patch)
treedd41cfd31e9bcee8a8be175d7fe9ba65e1b6ae9a
parent0cb9c0669152eb5d2a5301527a768bcb2e7097c6 (diff)
parent65e2d6eb01381a86c560806f519c51184e9954a8 (diff)
downloadgwtquery-45138b470ae618dbe986dc75bdbadae6ffbe991f.tar.gz
gwtquery-45138b470ae618dbe986dc75bdbadae6ffbe991f.zip
Merge pull request #324 from manolo/mcm_fix_jsongenerator
Fix to Json Builder
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java6
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java4
2 files changed, 6 insertions, 4 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java
index 8ccc9e75..c09836a5 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java
@@ -84,8 +84,10 @@ public abstract class JsonBuilderBase<J extends JsonBuilderBase<?>> implements J
}
protected Properties getPropertiesBase(String n) {
- Properties r = p.getJavaScriptObject(n);
- return r != null ? r : Properties.create();
+ if (p.getJavaScriptObject(n) == null) {
+ p.set(n, Properties.create());
+ }
+ return p.getJavaScriptObject(n);
}
public String toString() {
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java
index f85177de..c2383c19 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java
@@ -184,10 +184,10 @@ public class JsonBuilderGenerator extends Generator {
} else if (isTypeAssignableTo(method.getReturnType(), jsonBuilderType)) {
String q = method.getReturnType().getQualifiedSourceName();
sw.println("return " + "((" + q + ")GWT.create(" + q + ".class))"
- + ".load(p.getJavaScriptObject(\"" + name + "\"));");
+ + ".load(getPropertiesBase(\"" + name + "\"));");
} else if (isTypeAssignableTo(method.getReturnType(), settingsType)) {
String q = method.getReturnType().getQualifiedSourceName();
- sw.println("return " + "((" + q + ")p.getJavaScriptObject(\"" + name + "\"));");
+ sw.println("return " + "((" + q + ")getPropertiesBase(\"" + name + "\"));");
} else if (retType.equals(Properties.class.getName())) {
sw.println("return getPropertiesBase(\"" + name + "\");");
} else if (isTypeAssignableTo(method.getReturnType(), jsType)) {