enum choices {a1, a2, b1, b2};
方法一:
public static boolean contains(String test) { for (Choice c : Choice.values()) { if (c.name().equals(test)) { return true; } } return false; }
方法二:
EnumUtils.isValidEnum(MyEnum.class, myValue) //Apache commons lang3 lib