docs: public <E extends Enum<E>> E optEnum(Class<E> clazz, int index, E defaultValue) {
          try {
              Object val = this.opt(index);
              if (JSONObject.NULL.equals(val)) {
                  return defaultValue;
              }
              if (clazz.isAssignableFrom(val.getClass())) {
                  // we just checked it!
                  @SuppressWarnings("unchecked")
                  E myE = (E) val;
                  return myE;
              }
              return Enum.valueOf(clazz, val.toString());
          } catch (IllegalArgumentException e) {
              return defaultValue;
          } catch (NullPointerException e) {
              return defaultValue;
          }
      }