return -1;
}
@Override
public void writeTo(List objs, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4, MultivaluedMap<String, Object> arg5, OutputStream out) throws IOException, WebApplicationException {
JsonArray array = new JsonArray();
for(Object obj : objs) {
JsonParser parser = new JsonParser();
try {
JAXBContext context = JAXBContext.newInstance(obj.getClass());
Marshaller marshaller = context.createMarshaller();
StringWriter sw = new StringWriter();
JSONJAXBContext.getJSONMarshaller(marshaller).marshallToJSON(obj, sw);
array.add(parser.parse(sw.toString()));
}
catch(JAXBException e) {
array.add(new JsonPrimitive(obj.toString()));
}
}
out.write(new Gson().toJson(array).getBytes());
}