Field[] fields = enumType.getFields();
for (Field field : fields) {
if (field.isEnumConstant()) {
try {
field.setAccessible(true);
BoundEnumOption annotation = field
.getAnnotation(BoundEnumOption.class);
if (annotation == null) {
result.put(null, (T) field.get(null));
} else {
result.put(annotation.value(), (T) field.get(null));
}
}
catch (IllegalAccessException iae) {
iae.printStackTrace(); // Should never happen.
}