if (constant.getValue() == null) {
return (T) constant;
}
}
throw new EnumException("String enumeration value not found: " + value);
} else if (isIntegerEnum(clazz)) {
try {
Integer intValue = value == null ? null : Integer.parseInt(value);
return (T) getEnum(clazz, intValue);
} catch (NumberFormatException e) {
return (T) getEnum(clazz, (Integer) null); // a value that can't be parsed is effectively "unknown"
}
} else {
throw new EnumException("Enumeration class is not StringEnum or IntegerEnum");
}
}