}
else
{
throw new JsonParseException("Unsupported primitive value " + primitive);
}
return new SimplePropertyValue(result);
}
else if (json.isJsonArray())
{
JsonArray array = json.getAsJsonArray();
List<Object> result = new ArrayList<Object>(array.size());
for (JsonElement element : array)
{
result.add(context.deserialize(element, Object.class));
}
return new SimplePropertyValue(result);
}
else if (json.isJsonObject())
{
JsonObject object = json.getAsJsonObject();
JsonElement defElement = object.getAsJsonPrimitive(DEF_FIELD);
Class<?> classInstance = null;
if (defElement != null)
{
try
{
classInstance = _factory.getPropertyValueClass(defElement.getAsString());
}
catch (ClassNotFoundException e)
{
// ignore
}
}
if (classInstance == null)
{
Map<String, Object> result = new HashMap<String, Object>();
for (Map.Entry<String, JsonElement> entry : object.entrySet())
{
Object value = context.deserialize(entry.getValue(), Object.class);
result.put(entry.getKey(), value);
}
return new SimplePropertyValue(result);
}
else
{
return context.deserialize(json, classInstance);
}