aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Carrasco <manolo@apache.org>2013-12-19 05:49:04 -0800
committerManuel Carrasco <manolo@apache.org>2013-12-19 05:49:04 -0800
commitc0d4a56ebfe6b51e75b47654e997b46da5700e2e (patch)
tree75c68ae3efbfe56c41fde130759b0f54950c94b7
parent5ea9703b9b9321563dbf6ef147404348c702553f (diff)
parent0e9a003c78e85d8c535c72b53c68723ed74eda25 (diff)
downloadgwtquery-c0d4a56ebfe6b51e75b47654e997b46da5700e2e.tar.gz
gwtquery-c0d4a56ebfe6b51e75b47654e997b46da5700e2e.zip
Merge pull request #255 from gwtquery/mcm_fix_issue_230
Fix names in Data binder generators.
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java2
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/rebind/XmlBuilderGenerator.java2
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryAjaxTestGwt.java14
3 files changed, 9 insertions, 9 deletions
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 717fee32..51543454 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
@@ -95,7 +95,7 @@ public class JsonBuilderGenerator extends Generator {
String name = nameAnnotation != null
? nameAnnotation.value()
: methName.replaceFirst("^(get|set)", "");
- if (nameAnnotation != null) {
+ if (nameAnnotation == null) {
name = name.substring(0, 1).toLowerCase() + name.substring(1);
}
attrs.add(name);
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/XmlBuilderGenerator.java b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/XmlBuilderGenerator.java
index e8bc27c0..e643ecc1 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/XmlBuilderGenerator.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/XmlBuilderGenerator.java
@@ -85,7 +85,7 @@ public class XmlBuilderGenerator extends Generator {
String name = nameAnnotation != null ? nameAnnotation.value()
: method.getName().replaceFirst("^(get|set)", "");
- if (nameAnnotation != null) {
+ if (nameAnnotation == null) {
name = name.substring(0, 1).toLowerCase() + name.substring(1);
}
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryAjaxTestGwt.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryAjaxTestGwt.java
index 92765ce7..4d27f41a 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryAjaxTestGwt.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryAjaxTestGwt.java
@@ -72,6 +72,8 @@ public class GQueryAjaxTestGwt extends GWTTestCase {
interface JsonExample extends JsonBuilder {
int getA();
JsonExample getB();
+ @Name("M")
+ int getM();
@Name("u")
String getUrl();
long getD();
@@ -87,14 +89,14 @@ public class GQueryAjaxTestGwt extends GWTTestCase {
Function getF();
void setF(Function f);
}
-
-
+
boolean functionRun = false;
public void testJsonBuilder() {
- String json = "{a:1, b:{a:2,b:{a:3}},u:url, d:'2','t':['hola','adios'], 'z': true}";
+ String json = "{M:0, a:1, b:{a:2,b:{a:3}},u:url, d:'2','t':['hola','adios'], 'z': true}";
JsonExample c = GWT.create(JsonExample.class);
assertEquals(0, c.getA());
c.parse(json, true);
+ assertEquals(0, c.getM());
assertEquals(1, c.getA());
assertNotNull(c.getB());
assertEquals(2, c.getB().getA());
@@ -129,12 +131,10 @@ public class GQueryAjaxTestGwt extends GWTTestCase {
c.setItems(Arrays.asList(items));
assertEquals(2000l, c.getItems().get(0).getDate().getTime());
assertEquals(3000l, c.getItems().get(1).getDate().getTime());
- String s = "{'a':1,'b':{'a':2,'b':{'a':3}},'u':'url','d':1234,'t':['foo','bar'],'z':false,'y':'y','items':[{'date':2000},{'date':3000}]}";
+ String s = "{'M':0,'a':1,'b':{'a':2,'b':{'a':3}},'u':'url','d':1234,'t':['foo','bar'],'z':false,'y':'y','items':[{'date':2000},{'date':3000}]
assertEquals(s, c.toString().replaceAll("\"", "'"));
-
-
}
-
+
interface XmlExample extends XmlBuilder {
interface T extends XmlBuilder {
}