Exemple #1
0
  /**
   * 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;
  }
Exemple #2
0
  /** 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;
  }
Exemple #3
0
  /**
   * 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;
  }