/** It works as a converter, from integer to Type. */ public static Type fromInteger(int id) { for (Type type : Type.values()) { if (type.getValue() == id) { return type; } } return null; }
/** * Returns all literals as an array of strings. * * @return Array of strings. */ public static String[] toArrayOfStrings() { int length = Type.values().length; String[] types = new String[length]; int i = 0; for (Type type : Type.values()) { types[i] = type.toString(); i++; } return types; }
/** * Convert enumeration into a list. * * @return List of types. */ public static List<Type> toList() { Type[] types = Type.values(); List<Type> list = new ArrayList<>(); for (Type type : types) { list.add(type); } return list; }
/** * Given a type, this verifies whether they match. * * @param type Type to compare with. * @return Boolean. */ public boolean isEquals(Type type) { return this.getValue() == type.getValue(); }