Not much luck yet. Am I doing this right?
Type type = (new TypeLiteral<ArrayList<Foo>>() {}).getType();
getQuery.setSerializer(new JSONSerializer(type));
getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>() {
@Override
public void taskExecuted(Task<Object> task) {
ArrayList<Foo> result = (ArrayList<Foo>) task.getResult();
showResult(result);
}
@Override
public void executeFailed(Task<Object> task) {
String fault = task.getFault().toString();
showFault(fault);
}
}));
This fails with org.apache.pivot.web.QueryException: 500
org.apache.pivot.serialization.SerializationException: Cannot convert string
to org.apache.pivot.collections.ArrayList<com.fxpal.myunity.Foo>.
If I break on that inner exception, I'm at
JSONSerializer.readString(Reader) line: 389
JSONSerializer.readMapValue(Reader, Type) line: 695
JSONSerializer.readValue(Reader, Type) line: 304
JSONSerializer.readListValue(Reader, Type) line: 600
JSONSerializer.readValue(Reader, Type) line: 302
JSONSerializer.readObject(Reader) line: 272
JSONSerializer.readObject(InputStream) line: 231
GetQuery(Query<V>).execute(Query$Method, Object) line: 474
where it's failing the (type instanceof Class<?>) test. Variables window
shows that type.rawType is Class<T>
(org.apache.pivot.collections.ArrayList).