]> source.dussan.org Git - gwtquery.git/commitdiff
Rolling back commit r960 which was reverting r955 by mistake
authorManolo Carrasco <manolo@apache.org>
Wed, 8 Feb 2012 09:55:39 +0000 (09:55 +0000)
committerManolo Carrasco <manolo@apache.org>
Wed, 8 Feb 2012 09:55:39 +0000 (09:55 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java

index 3fcb79bff69c2ae0f8de409fd338fd129e123d05..63ee876638292198a26f8eab691f10cadd5edbf6 100644 (file)
@@ -46,6 +46,8 @@ public class JsonBuilderGenerator extends Generator {
   static JClassType jsType;\r
   static JClassType listType;\r
   static JClassType functionType;\r
+  static JClassType enumType;\r
+\r
 \r
   public String generate(TreeLogger treeLogger,\r
       GeneratorContext generatorContext, String requestedClass)\r
@@ -57,6 +59,7 @@ public class JsonBuilderGenerator extends Generator {
     jsType = oracle.findType(JavaScriptObject.class.getName());\r
     listType = oracle.findType(List.class.getName());\r
     functionType = oracle.findType(Function.class.getName());\r
+    enumType = oracle.findType(Enum.class.getName());\r
 \r
     String t[] = generateClassName(clazz);\r
 \r
@@ -154,8 +157,9 @@ public class JsonBuilderGenerator extends Generator {
         } else {\r
           sw.println("return Arrays.asList(" + ret + ");");\r
         }\r
-        \r
-      } else {\r
+      } else if (isTypeAssignableTo(method.getReturnType(), enumType)){  \r
+        sw.println("return "+method.getReturnType().getQualifiedSourceName()+".valueOf(p.getStr(\"" + name + "\"));");\r
+      }else {\r
         sw.println("System.err.println(\"JsonBuilderGenerator WARN: unknown return type " \r
             + retType + " " + ifaceName + "." + methName + "()\"); ");\r
         // We return the object because probably the user knows how to handle it\r