From: Manolo Carrasco Date: Wed, 8 Feb 2012 09:55:39 +0000 (+0000) Subject: Rolling back commit r960 which was reverting r955 by mistake X-Git-Tag: release-1.3.2~125 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cada43352ea5fb01060d783d0803a5a99b74dc42;p=gwtquery.git Rolling back commit r960 which was reverting r955 by mistake --- 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