@Nullable public static EErrorLevel getFromIDCaseInsensitiveOrNull (@Nullable final String sID) { return EnumHelper.getFromIDCaseInsensitiveOrNull (EErrorLevel.class, sID); }
@Nullable public static EMimeContentType getFromIDOrNull (@Nullable final String sID) { // As MIME types are not case sensitive, this method may not be either :) return EnumHelper.getFromIDCaseInsensitiveOrNull (EMimeContentType.class, sID); } }
@Nullable public static EFamFamFlagIcon getFromIDOrNull (@Nullable final String sID) { return EnumHelper.getFromIDCaseInsensitiveOrNull (EFamFamFlagIcon.class, sID); } }
/** * Get the enum value with the passed string ID (case insensitive). If no such * ID is present, an {@link IllegalArgumentException} is thrown. * * @param <ENUMTYPE> * The enum type * @param aClass * The enum class * @param sID * The ID to search * @return The enum item with the given ID. Never <code>null</code>. * @throws IllegalArgumentException * if no enum item with the given ID is present */ @Nonnull public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasID <String>> ENUMTYPE getFromIDCaseInsensitiveOrThrow (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sID) { final ENUMTYPE aEnum = getFromIDCaseInsensitiveOrNull (aClass, sID); if (aEnum == null) throw new IllegalArgumentException ("Failed to resolve ID " + sID + " within class " + aClass); return aEnum; }