code: public static <P extends Enum<P>> JSONObject optJSONObject(final JSONObject json, P e,
                                                                 boolean emptyForNull) {
          JSONObject jsonObject = optJSONObject(json, e);
          if (jsonObject == null && emptyForNull) {
              jsonObject = EMPTY_OBJECT;
          }
          return jsonObject;
      }
docs: Returns the value mapped by enum if it exists and is a {@link JSONObject}. If the value does
  not exist by that enum, and {@code emptyForNull} is {@code true}, returns
  {@link #EMPTY_OBJECT}. Otherwise, returns {@code null}.
  
  @param json         {@link JSONObject} to get data from
  @param e            {@link Enum} labeling the data to get
  @param emptyForNull {@code True} to return {@code EMPTY_OBJECT} if there is no mapped data,
  {@code false} to return {@code null} in that case
  @return A {@code JSONObject} if the mapping exists; {@code EMPTY_OBJECT} if it doesn't and
  {@code emptyForNull} is {@code true}; {@code null} otherwise