private Object instantiateFromName(final Class<?> type, final String name, final Target<?> to) {
try {
final Class<? extends Enum> enumClass = (Class<? extends Enum>) type;
return Enum.valueOf(enumClass, name);
} catch (final IllegalArgumentException iae) {
throw new ConversionException("Attempted to convert '%s' to an enum value of type '%s' " +
"(when trying to fulfill target %s)",
name, type.getName(), to);
}
}