Example #1
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;
  }
Example #2
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;
  }
Example #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;
  }
Example #4
0
 /**
  * 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();
 }