#589 - ElasticSearch - JsonReader given BeanType

This commit is contained in:
Robin Bygrave committed 2016-03-07 16:27:16 +13:00
1 parent f082fce1ff
commit 32bcd5e853
3 files changed
+28 -2

No files matched your search

@@ -3,6 +3,7 @@ package com.avaje.ebeaninternal.server.text.json;
import com.avaje.ebean.FetchPath;
import com.avaje.ebean.bean.EntityBean;
import com.avaje.ebean.config.JsonConfig;
import com.avaje.ebean.plugin.BeanType;
import com.avaje.ebean.text.json.EJson;
import com.avaje.ebean.text.json.JsonContext;
import com.avaje.ebean.text.json.JsonIOException;
@@ -125,6 +126,14 @@ public class DJsonContext implements JsonContext {
return new DJsonBeanReader<T>(desc, readJson);
}
@Override
public <T> DJsonBeanReader createBeanReader(BeanType<T> beanType, JsonParser parser, JsonReadOptions options) throws JsonIOException {
BeanDescriptor<T> desc = (BeanDescriptor<T>)beanType;
ReadJson readJson = new ReadJson(desc, parser, options, determineObjectMapper(options));
return new DJsonBeanReader<T>(desc, readJson);
}
public <T> List<T> toList(Class<T> cls, String json) throws JsonIOException {
return toList(cls, new StringReader(json));
}