Пример #1
0
 private static FailureType getById(String id) {
   for (FailureType type : FailureType.values()) {
     if (type.id.equals(id)) {
       return type;
     }
   }
   throw new IllegalArgumentException("Unknown failure ID: " + id);
 }
Пример #2
0
 public static String getIdsAsString() {
   FailureType[] types = FailureType.values();
   StringBuilder builder = new StringBuilder();
   for (int i = 0; i < types.length; i++) {
     builder.append(types[i].id);
     if (i < types.length - 1) {
       builder.append(", ");
     }
   }
   return builder.toString();
 }