aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Carrasco Moñino <manuel.carrasco.m@gmail.com>2013-12-28 18:09:51 +0100
committerManuel Carrasco Moñino <manuel.carrasco.m@gmail.com>2013-12-28 18:09:51 +0100
commit954b0e839a6ee93da7aece0822f558f7124d0942 (patch)
treee7bf98c382a379bac547e25ad7e74522c8291549
parent660641a9f2a3028fadfed7cfcc45f0df9fce05e1 (diff)
downloadgwtquery-954b0e839a6ee93da7aece0822f558f7124d0942.tar.gz
gwtquery-954b0e839a6ee93da7aece0822f558f7124d0942.zip
Use getName makes more sense
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilder.java5
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java10
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java2
3 files changed, 8 insertions, 9 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilder.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilder.java
index 887695d3..6508d300 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilder.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilder.java
@@ -38,8 +38,7 @@ public interface JsonBuilder extends Binder {
<J> J getProperties();
/**
- * return the Json name for this class
- * @deprecated use getName() instead;
+ * return the short name of this class, to use in json structures.
*/
- String getJsonName();
+ String getName();
}
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 4ec95de8..af3a5128 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
@@ -91,6 +91,11 @@ public abstract class JsonBuilderBase<J extends JsonBuilderBase<?>> implements J
return p.tostring();
}
+ @Override
+ public String toJson() {
+ return "{\"" + getName() + "\":" + p.tostring() + "}";
+ }
+
@SuppressWarnings("unchecked")
@Override
public Properties getProperties() {
@@ -102,11 +107,6 @@ public abstract class JsonBuilderBase<J extends JsonBuilderBase<?>> implements J
return p.toQueryString();
}
- @Override
- public String getName() {
- return getJsonName();
- }
-
@SuppressWarnings("unchecked")
@Override
public Properties getBound() {
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 8a45c6f9..8c9c7408 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
@@ -270,7 +270,7 @@ public class JsonBuilderGenerator extends Generator {
public void generateToJsonMethod(SourceWriter sw, String name, TreeLogger logger) {
sw.println("public final String getJsonName() {return \"" + name + "\";}");
- sw.println("public final String toJson() {return \"{\\\"\" + getJsonName() + \"\\\":\" + toString() + \"}\";}");
+ sw.println("public final String getName() {return \"" + name + "\";}");
}
protected SourceWriter getSourceWriter(TreeLogger logger,