From cada43352ea5fb01060d783d0803a5a99b74dc42 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Wed, 8 Feb 2012 09:55:39 +0000 Subject: [PATCH] Rolling back commit r960 which was reverting r955 by mistake --- .../com/google/gwt/query/rebind/JsonBuilderGenerator.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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..63ee8766 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 @@ -46,6 +46,8 @@ public class JsonBuilderGenerator extends Generator { static JClassType jsType; static JClassType listType; static JClassType functionType; + static JClassType enumType; + public String generate(TreeLogger treeLogger, GeneratorContext generatorContext, String requestedClass) @@ -57,6 +59,7 @@ public class JsonBuilderGenerator extends Generator { jsType = oracle.findType(JavaScriptObject.class.getName()); listType = oracle.findType(List.class.getName()); functionType = oracle.findType(Function.class.getName()); + enumType = oracle.findType(Enum.class.getName()); String t[] = generateClassName(clazz); @@ -154,8 +157,9 @@ public class JsonBuilderGenerator extends Generator { } 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 -- 2.39.5