public interface JsonContext
Converts objects to and from JSON format.
-
Method Summary
Modifier and TypeMethodDescription<T> JsonBeanReader<T>
createBeanReader
(BeanType<T> beanType, com.fasterxml.jackson.core.JsonParser parser, JsonReadOptions options) Create and return a new bean reading for the bean type given the JSON options and source.<T> JsonBeanReader<T>
createBeanReader
(Class<T> cls, com.fasterxml.jackson.core.JsonParser parser, JsonReadOptions options) Create and return a new bean reading for the bean type given the JSON options and source.com.fasterxml.jackson.core.JsonGenerator
createGenerator
(Writer writer) Create and return a new JsonGenerator for the given writer.com.fasterxml.jackson.core.JsonParser
createParser
(Reader reader) Create and return a new JsonParser for the given reader.boolean
isSupportedType
(Type genericType) Return true if the type is known as an Entity bean or a List Set or Map of entity beans.<T> T
Convert json parser input into a Bean of a specific type.<T> T
toBean
(Class<T> cls, com.fasterxml.jackson.core.JsonParser parser, JsonReadOptions options) Convert json parser input into a Bean of a specific type additionally using JsonReadOptions..<T> T
Convert json reader input into a Bean of a specific type.<T> T
toBean
(Class<T> rootType, Reader json, JsonReadOptions options) Convert json reader input into a Bean of a specific type additionally using JsonReadOptions.<T> T
Convert json string input into a Bean of a specific type.<T> T
toBean
(Class<T> rootType, String json, JsonReadOptions options) Convert json string input into a Bean of a specific type additionally using JsonReadOptions.<T> void
toBean
(T target, com.fasterxml.jackson.core.JsonParser parser) Read json parser input into a given Bean.<T> void
toBean
(T target, com.fasterxml.jackson.core.JsonParser parser, JsonReadOptions options) Read json parser input into a given Bean additionally using JsonReadOptions.
SeetoBean(Class, JsonParser)
for details modified.<T> void
Read json reader input into a given Bean.
SeetoBean(Class, JsonParser)
for details<T> void
toBean
(T target, Reader json, JsonReadOptions options) Read json reader input into a given Bean additionally using JsonReadOptions.
SeetoBean(Class, JsonParser)
for details modified.<T> void
Read json string input into a given Bean.
SeetoBean(Class, JsonParser)
for details<T> void
toBean
(T target, String json, JsonReadOptions options) Read json string input into a given Bean additionally using JsonReadOptions.
SeetoBean(Class, JsonParser)
for detailsReturn the bean or collection as JSON string.void
Write the bean or collection to the JsonGenerator.void
Write the bean or collection to the JsonGenerator using the FetchPath.void
toJson
(Object value, com.fasterxml.jackson.core.JsonGenerator generator, JsonWriteOptions options) Deprecated in favour of using PathProperties by itself.Return the bean or collection as JSON string using FetchPath.toJson
(Object value, JsonWriteOptions options) Deprecated in favour of using PathProperties by itself.void
Write the bean or collection in JSON format to the writer.void
Write the bean or collection as json to the writer using the FetchPath.void
toJson
(Object value, Writer writer, JsonWriteOptions options) Deprecated in favour of using PathProperties by itself.toJsonPretty
(Object value) Return the bean or collection as JSON string in pretty format.<T> List<T>
Convert json parser input into a list of beans of a specific type.<T> List<T>
toList
(Class<T> cls, com.fasterxml.jackson.core.JsonParser json, JsonReadOptions options) Convert json parser input into a list of beans of a specific type additionally using JsonReadOptions.<T> List<T>
Convert json reader input into a list of beans of a specific type.<T> List<T>
toList
(Class<T> rootType, Reader json, JsonReadOptions options) Convert json reader input into a list of beans of a specific type additionally using JsonReadOptions.<T> List<T>
Convert json string input into a list of beans of a specific type.<T> List<T>
toList
(Class<T> rootType, String json, JsonReadOptions options) Convert json string input into a list of beans of a specific type additionally using JsonReadOptions.Use the genericType to determine if this should be converted into a List or bean.Use the genericType to determine if this should be converted into a List or bean.Use the genericType to determine if this should be converted into a List or bean.void
writeScalar
(com.fasterxml.jackson.core.JsonGenerator generator, Object scalarValue) Write a scalar types known to Ebean to Jackson.
-
Method Details
-
toBean
Convert json string input into a Bean of a specific type.- Throws:
JsonIOException
- When IOException occurs
-
toBean
Convert json string input into a Bean of a specific type additionally using JsonReadOptions.- Throws:
JsonIOException
- When IOException occurs
-
toBean
Convert json reader input into a Bean of a specific type.- Throws:
JsonIOException
- When IOException occurs
-
toBean
Convert json reader input into a Bean of a specific type additionally using JsonReadOptions.- Throws:
JsonIOException
- When IOException occurs
-
toBean
Convert json parser input into a Bean of a specific type.- Throws:
JsonIOException
- When IOException occurs
-
toBean
<T> T toBean(Class<T> cls, com.fasterxml.jackson.core.JsonParser parser, JsonReadOptions options) throws JsonIOException Convert json parser input into a Bean of a specific type additionally using JsonReadOptions..- Throws:
JsonIOException
- When IOException occurs
-
toBean
Read json parser input into a given Bean.
Note: This is a kind of "update". Only properties in the json will be modified. Embedded Lists and Maps will become new instances, so the object identity will not be preserved here.- Throws:
JsonIOException
- When IOException occurs
-
toBean
<T> void toBean(T target, com.fasterxml.jackson.core.JsonParser parser, JsonReadOptions options) throws JsonIOException Read json parser input into a given Bean additionally using JsonReadOptions.
SeetoBean(Class, JsonParser)
for details modified.- Throws:
JsonIOException
- When IOException occurs
-
toBean
Read json reader input into a given Bean.
SeetoBean(Class, JsonParser)
for details- Throws:
JsonIOException
- When IOException occurs
-
toBean
Read json reader input into a given Bean additionally using JsonReadOptions.
SeetoBean(Class, JsonParser)
for details modified.- Throws:
JsonIOException
- When IOException occurs
-
toBean
Read json string input into a given Bean.
SeetoBean(Class, JsonParser)
for details- Throws:
JsonIOException
- When IOException occurs
-
toBean
Read json string input into a given Bean additionally using JsonReadOptions.
SeetoBean(Class, JsonParser)
for details- Throws:
JsonIOException
- When IOException occurs
-
createBeanReader
<T> JsonBeanReader<T> createBeanReader(Class<T> cls, com.fasterxml.jackson.core.JsonParser parser, JsonReadOptions options) throws JsonIOException Create and return a new bean reading for the bean type given the JSON options and source.Note that JsonOption provides an option for setting a persistence context and also enabling further lazy loading. Further lazy loading requires a persistence context so if that is set on then a persistence context is created if there is not one set.
- Throws:
JsonIOException
-
createBeanReader
<T> JsonBeanReader<T> createBeanReader(BeanType<T> beanType, com.fasterxml.jackson.core.JsonParser parser, JsonReadOptions options) throws JsonIOException Create and return a new bean reading for the bean type given the JSON options and source.Note that JsonOption provides an option for setting a persistence context and also enabling further lazy loading. Further lazy loading requires a persistence context so if that is set on then a persistence context is created if there is not one set.
- Throws:
JsonIOException
-
toList
Convert json string input into a list of beans of a specific type.- Throws:
JsonIOException
- When IOException occurs
-
toList
Convert json string input into a list of beans of a specific type additionally using JsonReadOptions.- Throws:
JsonIOException
- When IOException occurs
-
toList
Convert json reader input into a list of beans of a specific type.- Throws:
JsonIOException
- When IOException occurs
-
toList
Convert json reader input into a list of beans of a specific type additionally using JsonReadOptions.- Throws:
JsonIOException
- When IOException occurs
-
toList
Convert json parser input into a list of beans of a specific type.- Throws:
JsonIOException
- When IOException occurs
-
toList
<T> List<T> toList(Class<T> cls, com.fasterxml.jackson.core.JsonParser json, JsonReadOptions options) throws JsonIOException Convert json parser input into a list of beans of a specific type additionally using JsonReadOptions.- Throws:
JsonIOException
- When IOException occurs
-
toObject
Use the genericType to determine if this should be converted into a List or bean.- Throws:
JsonIOException
- When IOException occurs
-
toObject
Use the genericType to determine if this should be converted into a List or bean.- Throws:
JsonIOException
- When IOException occurs
-
toObject
Object toObject(Type genericType, com.fasterxml.jackson.core.JsonParser jsonParser) throws JsonIOException Use the genericType to determine if this should be converted into a List or bean.- Throws:
JsonIOException
- When IOException occurs
-
toJson
Return the bean or collection as JSON string.- Throws:
JsonIOException
- When IOException occurs
-
toJsonPretty
Return the bean or collection as JSON string in pretty format.- Throws:
JsonIOException
- When IOException occurs
-
toJson
Write the bean or collection in JSON format to the writer.- Throws:
JsonIOException
- When IOException occurs
-
toJson
void toJson(Object value, com.fasterxml.jackson.core.JsonGenerator generator) throws JsonIOException Write the bean or collection to the JsonGenerator.- Throws:
JsonIOException
- When IOException occurs
-
toJson
Return the bean or collection as JSON string using FetchPath.- Throws:
JsonIOException
- When IOException occurs
-
toJson
Write the bean or collection as json to the writer using the FetchPath.- Throws:
JsonIOException
-
toJson
void toJson(Object value, com.fasterxml.jackson.core.JsonGenerator generator, FetchPath fetchPath) throws JsonIOException Write the bean or collection to the JsonGenerator using the FetchPath.- Throws:
JsonIOException
-
toJson
void toJson(Object value, com.fasterxml.jackson.core.JsonGenerator generator, JsonWriteOptions options) throws JsonIOException Deprecated in favour of using PathProperties by itself. Write json to the JsonGenerator using the JsonWriteOptions.- Throws:
JsonIOException
-
toJson
Deprecated in favour of using PathProperties by itself. With additional options.- Throws:
JsonIOException
- When IOException occurs
-
toJson
Deprecated in favour of using PathProperties by itself. Convert a bean or collection to json string.- Throws:
JsonIOException
- When IOException occurs
-
isSupportedType
Return true if the type is known as an Entity bean or a List Set or Map of entity beans. -
createGenerator
Create and return a new JsonGenerator for the given writer.- Throws:
JsonIOException
- When IOException occurs
-
createParser
Create and return a new JsonParser for the given reader.- Throws:
JsonIOException
- When IOException occurs
-
writeScalar
void writeScalar(com.fasterxml.jackson.core.JsonGenerator generator, Object scalarValue) throws IOException Write a scalar types known to Ebean to Jackson.Ebean has built in support for java8 and Joda types as well as the other standard JDK types like URI, URL, UUID etc. This is a fast simple way to write any of those types to Jackson.
- Throws:
IOException
-