@Override
public Object toJava(JSONValue aValue, Class aRequestedClass) throws MapperException {
if (aValue.isObject()) {
final JSONObject jsonObject = (JSONObject) aValue;
final AjProperty out = new AjProperty();
out.setIdProperty(Helper.getIntRequired(jsonObject, "idProperty",
"AjProperty property idProperty was not found in json data"));
out.setName(Helper.getStringRequired(jsonObject, "name",
"AjProperty property name was not found in json data"));
out.setValues(new ArrayList<AjPropertyValue>());
JSONArray array = (JSONArray) jsonObject.get("values");
for (JSONValue jsonValue : array.getValue()) {
out.getValues().add(
(AjPropertyValue) JSONMapper.toJava(jsonValue, AjPropertyValue.class));
}
return out;
}
throw new MapperException("AjPropertyValue cannot map: " + aValue.getClass().getName());