@Override
public Object toJava(JSONValue aValue, Class aRequestedClass) throws MapperException {
if (aValue.isObject()) {
final JSONObject jsonObject = (JSONObject) aValue;
final AjPageable out = new AjPageable();
out.setAsc(Helper.getBooleanRequired(jsonObject, "asc",
"AjPageable property asc was not found in json data"));
out.setBase(Helper.getIntRequired(jsonObject, "base",
"AjPageable property base was not found in json data"));
out.setCurrentPageNo(Helper.getIntRequired(jsonObject, "currentPageNo",
"AjPageable property currentPageNo was not found in json data"));
out.setOrderBy(Helper.getStringRequired(jsonObject, "orderBy",
"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>());
JSONArray array = (JSONArray) list;
for (JSONValue jsonValue : array.getValue()) {
out.getCurrentPage().add(
(AjLegoBox) JSONMapper.toJava(jsonValue, AjLegoBox.class));
}
}
return out;