Added generation of new Field enum within generated object POJOs to provide compile time literals for individual field names useful in tests and client deployments.
@@ -63,4 +63,25 @@ public class ${object.name} #if($object.implementz.size()>0)implements #foreach(
#end
+ "}";
}
+
+ /**
+ * Enum of field names
+ */
+ public static enum Field {
+#foreach ($field in $object.fields)
+ ${field.pascalCaseName}("${field.name}")#if($foreach.hasNext),
+#end
+#end;
+
+ private String fieldName;
+
+ Field(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ }
}
