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; } } } }
@Override public int compareTo(HttpStatusCode o) { return value().compareTo(o.value()); }
/** * @param number * @return a HttpStatusCode object. */ public static HttpStatusCode register(HttpStatusCode number) { return registry.put(number.value(), number); }