diff options
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java | 14 |
1 files changed, 9 insertions, 5 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 3fcb79bf..ea358f90 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 @@ -44,8 +44,10 @@ public class JsonBuilderGenerator extends Generator { static JClassType jsonBuilderType;
static JClassType stringType;
static JClassType jsType;
- static JClassType listType;
+ static JClassType listType; static JClassType functionType;
+ static JClassType enumType;
+ public String generate(TreeLogger treeLogger,
GeneratorContext generatorContext, String requestedClass)
@@ -55,8 +57,9 @@ public class JsonBuilderGenerator extends Generator { jsonBuilderType = oracle.findType(JsonBuilder.class.getName());
stringType = oracle.findType(String.class.getName());
jsType = oracle.findType(JavaScriptObject.class.getName());
- listType = oracle.findType(List.class.getName());
+ listType = oracle.findType(List.class.getName()); functionType = oracle.findType(Function.class.getName());
+ enumType = oracle.findType(Enum.class.getName()); String t[] = generateClassName(clazz);
@@ -153,9 +156,10 @@ public class JsonBuilderGenerator extends Generator { sw.println("return " + ret + ";");
} else {
sw.println("return Arrays.asList(" + ret + ");");
- }
-
- } else {
+ } + } else if (isTypeAssignableTo(method.getReturnType(), enumType)){
+ sw.println("return "+method.getReturnType().getQualifiedSourceName()+".valueOf(p.getStr(\"" + name + "\"));");
+ }else { sw.println("System.err.println(\"JsonBuilderGenerator WARN: unknown return type "
+ retType + " " + ifaceName + "." + methName + "()\"); ");
// We return the object because probably the user knows how to handle it
|