mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Allow more flexibility with JSON marshalling of non-entity beans
This commit is contained in:
+2
-1
@@ -376,7 +376,8 @@ public class DeployCreateProperties {
|
||||
if (typeArgs[0] instanceof Class<?>){
|
||||
return (Class<?>) typeArgs[0];
|
||||
}
|
||||
throw new RuntimeException("Unexpected Parameterised Type? "+typeArgs[0]);
|
||||
//throw new RuntimeException("Unexpected Parameterised Type? "+typeArgs[0]);
|
||||
return null;
|
||||
}
|
||||
if (typeArgs.length == 2) {
|
||||
// this is probably a Map
|
||||
|
||||
@@ -71,25 +71,24 @@ public class WriteJsonContext implements JsonWriter {
|
||||
|
||||
public void toJson(String name, Collection<?> c) {
|
||||
|
||||
internalAppendKeyBegin(name);
|
||||
beginAssocMany(name);
|
||||
|
||||
Iterator<?> it = c.iterator();
|
||||
if (!it.hasNext()){
|
||||
buffer.append("[]");
|
||||
endAssocMany();
|
||||
return;
|
||||
}
|
||||
|
||||
Object o = it.next();
|
||||
BeanDescriptor<?> d = getDecriptor(o.getClass());
|
||||
|
||||
appendArrayBegin();
|
||||
d.jsonWrite(this, o);
|
||||
while (it.hasNext()) {
|
||||
appendComma();
|
||||
Object t = it.next();
|
||||
d.jsonWrite(this, t);
|
||||
}
|
||||
appendArrayEnd();
|
||||
endAssocMany();
|
||||
}
|
||||
|
||||
private <T> BeanDescriptor<T> getDecriptor(Class<T> cls) {
|
||||
|
||||
Reference in New Issue
Block a user