Пример #1
0
 static {
   for (Field field : HttpStatusCode.class.getFields()) {
     if (HttpStatusCode.class.isAssignableFrom(field.getType())) {
       try {
         HttpStatusCode f = (HttpStatusCode) field.get(null);
         registry.put(f.value(), f);
       } catch (IllegalArgumentException e) {
         throw new AssertionError(e);
       } catch (IllegalAccessException e) {
         throw new AssertionError(e);
       } catch (NullPointerException e) {
         continue;
       }
     }
   }
 }
Пример #2
0
 @Override
 public int compareTo(HttpStatusCode o) {
   return value().compareTo(o.value());
 }
Пример #3
0
 /**
  * @param number
  * @return a HttpStatusCode object.
  */
 public static HttpStatusCode register(HttpStatusCode number) {
   return registry.put(number.value(), number);
 }