Package com.sdicons.json.mapper

Examples of com.sdicons.json.mapper.MapperException


        "AjUser property idBlog was not found in json data"));
      out.setLastLogin(Helper.getDate(jsonObject, "lastLogin"));
      out.setRegistrationDate(Helper.getDate(jsonObject, "registrationDate"));
      return out;
  }
  throw new MapperException("AjPropertyValue cannot map: " + aValue.getClass().getName());
    }
View Full Code Here


      lElements.getValue().put("lastLogin", JSONMapper.toJSON(user.getLastLogin()));
      lElements.getValue().put("registrationDate",
        JSONMapper.toJSON(user.getRegistrationDate()));
      return lElements;
  } else {
      throw new MapperException();
  }
    }
View Full Code Here

      } else {
    out.setTo((Integer) JSONMapper.toJava(jsonObject.get("to"), Integer.class));
      }
      return out;
  }
  throw new MapperException("BooleanMapper cannot map: " + aValue.getClass().getName());
    }
View Full Code Here

    out.getValues().add(
      (AjPropertyValue) JSONMapper.toJava(jsonValue, AjPropertyValue.class));
      }
      return out;
  }
  throw new MapperException("AjPropertyValue cannot map: " + aValue.getClass().getName());
    }
View Full Code Here

        "AjPropertyValue property webName was not found in json data"));
      out.setCount(Helper.getIntRequired(jsonObject, "count",
        "AjPropertyValue property count was not found in json data"));
      return out;
  }
  throw new MapperException("AjPropertyValue cannot map: " + aValue.getClass().getName());
    }
View Full Code Here

    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

        "AjLegoBox property separator was not found in json data"));
      out.setTags(Helper.getStringRequired(jsonObject, "tags",
        "AjLegoBox property tags was not found in json data"));
      return out;
  }
  throw new MapperException("AjPropertyValue cannot map: " + aValue.getClass().getName());
    }
View Full Code Here

        "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>());
    JSONArray array = (JSONArray) list;
    for (JSONValue jsonValue : array.getValue()) {
        out.getCurrentPage().add(
          (AjLegoBox) JSONMapper.toJava(jsonValue, AjLegoBox.class));
    }

      }
      return out;
  }
  throw new MapperException("AjPropertyValue cannot map: " + aValue.getClass().getName());
    }
View Full Code Here

TOP

Related Classes of com.sdicons.json.mapper.MapperException

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.