コード例 #1
0
  /**
   * Enum for value.
   *
   * @param value the value
   * @return the meter status enum
   */
  public static DeviceStateEnum enumForValue(Integer value) {
    for (DeviceStateEnum e : values()) {
      if (e.getValue().equals(value)) {
        return e;
      }
    }

    return null;
  }
コード例 #2
0
  /**
   * Gets the valid values.
   *
   * @return the valid values
   */
  public static String getValidValues() {
    DeviceStateEnum[] enums = DeviceStateEnum.class.getEnumConstants();

    String comma = "";
    StringBuilder enumValue = new StringBuilder();
    for (DeviceStateEnum i : enums) {
      enumValue.append(comma + i.getValue());
      comma = ", ";
    }
    return enumValue.toString();
  }