Package net.hearthstats.updater.exception

Examples of net.hearthstats.updater.exception.JsonException


    if (value == null) {
      return null;
    } else if (value instanceof JSONObject) {
      return new JsonWrapper(context + "." + key, (JSONObject) value);
    } else {
      throw new JsonException("Expected " + context + "." + key + " to be JSONObject but it is " + value.getClass().getSimpleName());
    }
  }
View Full Code Here


    if (inputList != null) {
      for (int i = 0; i < inputList.size(); i++) {
        try {
          resultList.add(new JsonWrapper(context + "." + key + "[" + i + "]", inputList.get(i)));
        } catch (ClassCastException e) {
          throw new JsonException("Expected " + context + "." + key + "[" + i + "] to be JSONObject but it is not");
        }
      }
    }

    return resultList;
View Full Code Here

    if (value == null) {
      return null;
    } else if (value instanceof String) {
      return (String) value;
    } else {
      throw new JsonException("Expected " + context + "." + key + " to be String but it is " + value.getClass().getSimpleName());
    }
  }
View Full Code Here

    if (value == null) {
      return null;
    } else if (value instanceof Number) {
      return (Number) value;
    } else {
      throw new JsonException("Expected " + context + "." + key + " to be Number but it is " + value.getClass().getSimpleName());
    }
  }
View Full Code Here

    if (value == null) {
      return null;
    } else if (value instanceof Boolean) {
      return (Boolean) value;
    } else {
      throw new JsonException("Expected " + context + "." + key + " to be Boolean but it is " + value.getClass().getSimpleName());
    }
  }
View Full Code Here

      for (Object item : (List<?>) value) {
        resultList.add((T) item);
      }
      return resultList;
    } else {
      throw new JsonException("Expected " + context + "." + key + " to be JSONArray but it is " + value.getClass().getSimpleName());
    }
  }
View Full Code Here

TOP

Related Classes of net.hearthstats.updater.exception.JsonException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.