+ if (propertyType.isEnum()) {
+ try {
+ final Method enumConstructor = propertyType.getDeclaredMethod("forName", String.class);
+ final Object optional = enumConstructor.invoke(null, from.toString().toLowerCase(Locale.ROOT));
+ if (optional instanceof Optional) {
+ return ((Optional<Object>)optional).orElseThrow();
+ }
+ } catch (NoSuchMethodException e) {
+ LOG.error("Error constructing value ({}) for enum {}", from, propertyType);
+ }
+ }
+