public static boolean containsField(String fieldName) { IbidianClickEnum[] fields = IbidianClickEnum.values(); Set<String> fieldsSet = new HashSet<String>(); for (IbidianClickEnum ibidianClickEnum : fields) { fieldsSet.add(ibidianClickEnum.name()); } return fieldsSet.contains(fieldName); }
public static int getFieldOrder(String fieldName) throws CustomEnumFieldNotFoundException { IbidianClickEnum[] fields = IbidianClickEnum.values(); for (IbidianClickEnum singleEnum : fields) { if (fieldName.equals(singleEnum.name())) { return singleEnum.ordinal(); } } throw new CustomEnumFieldNotFoundException(IbidianClickEnum.class.getName(), fieldName); }