Class ReadJson
- java.lang.Object
-
- io.ebeaninternal.server.text.json.ReadJson
-
- All Implemented Interfaces:
SpiJsonReader
public class ReadJson extends Object implements SpiJsonReader
Context for JSON read processing.
-
-
Constructor Summary
Constructors Constructor Description ReadJson(BeanDescriptor<?> desc, com.fasterxml.jackson.core.JsonParser parser, JsonReadOptions readOptions, Object objectMapper)
Construct with parser and readOptions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beanVisitor(Object bean, Map<String,Object> unmappedProperties)
If there is a JsonReadBeanVisitor registered to the current path then call it's visit method with the bean and unmappedProperties.SpiJsonReader
forJson(com.fasterxml.jackson.core.JsonParser moreJson, boolean resetContext)
Return a new instance of ReadJson using the existing context but with a new JsonParser.com.fasterxml.jackson.databind.ObjectMapper
getObjectMapper()
Return the objectMapper used for this request.com.fasterxml.jackson.core.JsonParser
getParser()
Return the JsonParser.PersistenceContext
getPersistenceContext()
Return the persistence context being used if any.com.fasterxml.jackson.core.JsonToken
nextToken()
Return the next JsonToken from the underlying parser.<T> void
persistenceContextPut(Object beanId, T currentBean)
Add the bean to the persistence context.Object
persistenceContextPutIfAbsent(Object id, EntityBean bean, BeanDescriptor<?> beanDesc)
Put the bean into the persistence context.void
popPath()
Pop the path stack.void
pushPath(String path)
Push the path onto the stack (traversing a 1-M or M-1 etc)Object
readValueUsingObjectMapper(Class<?> propertyType)
Read the property value using Jackson ObjectMapper.
-
-
-
Constructor Detail
-
ReadJson
public ReadJson(BeanDescriptor<?> desc, com.fasterxml.jackson.core.JsonParser parser, JsonReadOptions readOptions, Object objectMapper)
Construct with parser and readOptions.
-
-
Method Detail
-
getPersistenceContext
public PersistenceContext getPersistenceContext()
Return the persistence context being used if any.- Specified by:
getPersistenceContext
in interfaceSpiJsonReader
-
forJson
public SpiJsonReader forJson(com.fasterxml.jackson.core.JsonParser moreJson, boolean resetContext)
Return a new instance of ReadJson using the existing context but with a new JsonParser.- Specified by:
forJson
in interfaceSpiJsonReader
-
persistenceContextPut
public <T> void persistenceContextPut(Object beanId, T currentBean)
Add the bean to the persistence context.- Specified by:
persistenceContextPut
in interfaceSpiJsonReader
-
persistenceContextPutIfAbsent
public Object persistenceContextPutIfAbsent(Object id, EntityBean bean, BeanDescriptor<?> beanDesc)
Put the bean into the persistence context. If there is already a matching bean in the persistence context then return that instance else return null.- Specified by:
persistenceContextPutIfAbsent
in interfaceSpiJsonReader
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
Return the objectMapper used for this request.- Specified by:
getObjectMapper
in interfaceSpiJsonReader
-
getParser
public com.fasterxml.jackson.core.JsonParser getParser()
Return the JsonParser.- Specified by:
getParser
in interfaceSpiJsonReader
-
nextToken
public com.fasterxml.jackson.core.JsonToken nextToken() throws IOException
Return the next JsonToken from the underlying parser.- Specified by:
nextToken
in interfaceSpiJsonReader
- Throws:
IOException
-
pushPath
public void pushPath(String path)
Push the path onto the stack (traversing a 1-M or M-1 etc)- Specified by:
pushPath
in interfaceSpiJsonReader
-
popPath
public void popPath()
Pop the path stack.- Specified by:
popPath
in interfaceSpiJsonReader
-
beanVisitor
public void beanVisitor(Object bean, Map<String,Object> unmappedProperties)
If there is a JsonReadBeanVisitor registered to the current path then call it's visit method with the bean and unmappedProperties.- Specified by:
beanVisitor
in interfaceSpiJsonReader
-
readValueUsingObjectMapper
public Object readValueUsingObjectMapper(Class<?> propertyType) throws IOException
Read the property value using Jackson ObjectMapper. Typically this is used to read Transient properties where the type is unknown to Ebean.- Specified by:
readValueUsingObjectMapper
in interfaceSpiJsonReader
- Throws:
IOException
-
-