List<String> fields = Lists.newArrayList();
for (Element element : typeElement.getEnclosedElements()) {
if (element.getKind() == ElementKind.ENUM_CONSTANT) {
String field = element.getSimpleName().toString();
ErrorField errorField = element.getAnnotation(ErrorField.class);
String description = errorField == null ? field.replace("_", " ").toLowerCase(Locale.ENGLISH)
: errorField.value();
fields.add(String.format(".put(\"%s\", new ErrorDescriptor.ErrorFieldDescriptor(\"%s\", \"%s\"))",
field, field, description));
}
}