Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Add ImmutableConfiguration.getEnum methods:
- org.apache.commons.configuration2.ImmutableConfiguration.getEnum(String, Class<T>)
- org.apache.commons.configuration2.ImmutableConfiguration.getEnum(String, Class<T>, T)
/** * Gets an enum associated with the given configuration key. * * @param <T> The enum type whose constant is to be returned. * @param enumType the \{@code Class} object of the enum type from which to return a constant * @param key The configuration key. * @return The associated enum. * * @throws org.apache.commons.configuration2.ex.ConversionException is thrown if the key maps to an object that * is not a String. * @since 2.8 */ default <T extends Enum<T>> T getEnum(String key, Class<T> enumType)
and
/** * Gets the enum associated with the given configuration key. If the key doesn't map to an existing object, the * default value is returned. * * @param <T> The enum type whose constant is to be returned. * @param key The configuration key. * @param enumType the \{@code Class} object of the enum type from which to return a constant * @param defaultValue The default value. * @return The associated enum if key is found and has valid format, default value otherwise. * * @throws org.apache.commons.configuration2.ex.ConversionException is thrown if the key maps to an object that is * not a Enum. * @since 2.8 */ default <T extends Enum<T>> T getEnum(String key, Class<T> enumType, T defaultValue)