Package com.sdicons.json.model

Examples of com.sdicons.json.model.JSONValue


  private Result parseResponseJSON(InputStream response) throws Exception {
    try {
      Result results = new Result();
      int cont = 0;
      JSONParser parser = new JSONParser(response);
      JSONValue jsonObject = parser.nextValue();
      if (jsonObject.isComplex()) {

        JSONObject complex = (JSONObject) jsonObject;
        JSONObject jsonResults = (JSONObject) complex.get("results");
        JSONArray bindings = (JSONArray) jsonResults.get("bindings");
        for (int i = 0; i < bindings.getValue().size(); i++) {
View Full Code Here


    @Override
    public Object toJava(JSONValue aValue, Class aRequestedClass) throws MapperException {
  if (aValue.isObject()) {
      final JSONObject jsonObject = (JSONObject) aValue;
      final AjSelectionRange out = new AjSelectionRange();
      final JSONValue fromJsonValue = jsonObject.get("from");
      if (fromJsonValue == null) {
    out.setFrom(-1);
      } else {
    out.setFrom((Integer) JSONMapper.toJava(fromJsonValue, Integer.class));
      }
      final JSONValue toJsonValue = jsonObject.get("to");
      if (toJsonValue == null) {
    out.setTo(Integer.MAX_VALUE);
      } else {
    out.setTo((Integer) JSONMapper.toJava(jsonObject.get("to"), Integer.class));
      }
View Full Code Here

*/
public class Helper {

    static Integer getIntRequired(final JSONObject jsonObject, final String name,
      final String errorMessage) throws MapperException {
  final JSONValue fromJsonValue = jsonObject.get(name);
  if (fromJsonValue == null) {
      throw new MapperException(errorMessage);
  } else {
      return (Integer) JSONMapper.toJava(fromJsonValue, Integer.class);
  }
View Full Code Here

  }
    }

    static String getStringRequired(final JSONObject jsonObject, final String name,
      final String errorMessage) throws MapperException {
  final JSONValue fromJsonValue = jsonObject.get(name);
  if (fromJsonValue == null) {
      throw new MapperException(errorMessage);
  } else {
      return (String) JSONMapper.toJava(fromJsonValue, String.class);
  }
View Full Code Here

  }
    }

    static boolean getBooleanRequired(final JSONObject jsonObject, final String name,
      final String errorMessage) throws MapperException {
  final JSONValue fromJsonValue = jsonObject.get(name);
  if (fromJsonValue == null) {
      throw new MapperException(errorMessage);
  } else {
      return (Boolean) JSONMapper.toJava(fromJsonValue, Boolean.class);
  }
View Full Code Here

      return (Boolean) JSONMapper.toJava(fromJsonValue, Boolean.class);
  }
    }

    static Date getDate(final JSONObject jsonObject, final String name) throws MapperException {
  final JSONValue fromJsonValue = jsonObject.get(name);
  if (fromJsonValue == null) {
      return null;
  } else {
      return (Date) JSONMapper.toJava(fromJsonValue, Date.class);
  }
View Full Code Here

        "AjPageable property orderBy was not found in json data"));
      out.setRowCount(Helper.getIntRequired(jsonObject, "rowCount",
        "AjPageable property rowCount was not found in json data"));
      out.setRowPerPage(Helper.getIntRequired(jsonObject, "rowPerPage",
        "AjPageable property rowPerPage was not found in json data"));
      JSONValue list = jsonObject.get("currentPage");
      if (list == null) {
    throw new MapperException(
      "AjPageable property currentPage was not found in json data");
      } else {
    out.setCurrentPage(new ArrayList<AjLegoBox>());
View Full Code Here

TOP

Related Classes of com.sdicons.json.model.JSONValue

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.