Class ReadJson

java.lang.Object
io.ebeaninternal.server.json.ReadJson
All Implemented Interfaces:
SpiJsonReader

public final 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, io.ebean.text.json.JsonReadOptions readOptions, Object objectMapper, boolean update)
    Construct with parser and readOptions.
  • Method Summary

    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.
    forJson(com.fasterxml.jackson.core.JsonParser moreJson)
    Return a new instance of ReadJson using the existing context but with a new JsonParser.
    com.fasterxml.jackson.databind.ObjectMapper
    Return the objectMapper used for this request.
    com.fasterxml.jackson.core.JsonToken
    Return the next JsonToken from the underlying parser.
    com.fasterxml.jackson.core.JsonParser
    Return the JsonParser.
    io.ebean.bean.PersistenceContext
    Return the persistence context being used if any.
    <T> void
    persistenceContextPut(Object beanId, T currentBean)
    Add the bean to the persistence context.
    persistenceContextPutIfAbsent(Object id, io.ebean.bean.EntityBean bean, BeanDescriptor<?> beanDesc)
    Put the bean into the persistence context.
    void
    Pop the path stack.
    void
    Push the path onto the stack (traversing a 1-M or M-1 etc)
    Read the property value using Jackson ObjectMapper.
    boolean
    Do we update an existing bean?

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ReadJson

      public ReadJson(BeanDescriptor<?> desc, com.fasterxml.jackson.core.JsonParser parser, io.ebean.text.json.JsonReadOptions readOptions, Object objectMapper, boolean update)
      Construct with parser and readOptions.
  • Method Details

    • persistenceContext

      public io.ebean.bean.PersistenceContext persistenceContext()
      Return the persistence context being used if any.
      Specified by:
      persistenceContext in interface SpiJsonReader
    • forJson

      public SpiJsonReader forJson(com.fasterxml.jackson.core.JsonParser moreJson)
      Return a new instance of ReadJson using the existing context but with a new JsonParser.
      Specified by:
      forJson in interface SpiJsonReader
    • persistenceContextPut

      public <T> void persistenceContextPut(Object beanId, T currentBean)
      Add the bean to the persistence context.
      Specified by:
      persistenceContextPut in interface SpiJsonReader
    • persistenceContextPutIfAbsent

      public Object persistenceContextPutIfAbsent(Object id, io.ebean.bean.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 interface SpiJsonReader
    • mapper

      public com.fasterxml.jackson.databind.ObjectMapper mapper()
      Return the objectMapper used for this request.
      Specified by:
      mapper in interface SpiJsonReader
    • parser

      public com.fasterxml.jackson.core.JsonParser parser()
      Return the JsonParser.
      Specified by:
      parser in interface SpiJsonReader
    • nextToken

      public com.fasterxml.jackson.core.JsonToken nextToken() throws IOException
      Return the next JsonToken from the underlying parser.
      Specified by:
      nextToken in interface SpiJsonReader
      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 interface SpiJsonReader
    • popPath

      public void popPath()
      Pop the path stack.
      Specified by:
      popPath in interface SpiJsonReader
    • 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 interface SpiJsonReader
    • 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 interface SpiJsonReader
      Throws:
      IOException
    • update

      public boolean update()
      Do we update an existing bean? This meeans we have to set values via intercept and handle collections.
      Specified by:
      update in interface SpiJsonReader