static JClassType jsonBuilderType;\r
static JClassType stringType;\r
static JClassType jsType;\r
- static JClassType listType;\r
+ static JClassType listType;
static JClassType functionType;\r
+ static JClassType enumType;\r
+
\r
public String generate(TreeLogger treeLogger,\r
GeneratorContext generatorContext, String requestedClass)\r
jsonBuilderType = oracle.findType(JsonBuilder.class.getName());\r
stringType = oracle.findType(String.class.getName());\r
jsType = oracle.findType(JavaScriptObject.class.getName());\r
- listType = oracle.findType(List.class.getName());\r
+ listType = oracle.findType(List.class.getName());
functionType = oracle.findType(Function.class.getName());\r
+ enumType = oracle.findType(Enum.class.getName());
\r
String t[] = generateClassName(clazz);\r
\r
sw.println("return " + ret + ";");\r
} 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 {
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