Class DJsonService

java.lang.Object
io.ebeaninternal.json.DJsonService
All Implemented Interfaces:
io.ebean.service.BootstrapService, io.ebean.service.SpiJsonService

public final class DJsonService extends Object implements io.ebean.service.SpiJsonService
Utility that converts between JSON content and simple java Maps/Lists.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    parse(com.fasterxml.jackson.core.JsonParser parser)
    Parse the json and return as a List or Map.
    parse(Reader reader)
    Parse the json and return as a List or Map.
    parse(String json)
    Parse the json and return as a List or Map.
    parseList(com.fasterxml.jackson.core.JsonParser parser)
    Parse the json and return as a List taking a JsonParser.
    <T> List<T>
    parseList(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.core.JsonToken currentToken)
    Parse the json returning as a List taking into account the current token.
    parseList(Reader reader)
    Parse the json and return as a List taking a Reader.
    Parse the json and return as a List.
    <T> List<T>
    parseList(String json, boolean modifyAware)
    Parse the json and return as a modify aware List.
    parseObject(com.fasterxml.jackson.core.JsonParser parser)
    Parse the json and return as a Map taking a JsonParser.
    parseObject(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.core.JsonToken token)
    Parse the json and return as a Map taking a JsonParser and a starting token.
    Parse the json and return as a Map taking a reader.
    parseObject(Reader reader, boolean modifyAware)
    Parse the json and return as a Map taking a reader.
    Parse the json and return as a Map.
    parseObject(String json, boolean modifyAware)
    Parse the json and return as a Map additionally specifying if the returned map should be modify aware meaning that it can detect when it has been modified.
    <T> Set<T>
    parseSet(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.core.JsonToken currentToken)
    Parse the json returning as a Set taking into account the current token.
    <T> Set<T>
    parseSet(String json, boolean modifyAware)
    Parse the json returning a Set that might be modify aware.
    write(Object object)
    Write the nested Map/List as json.
    void
    write(Object object, com.fasterxml.jackson.core.JsonGenerator jsonGenerator)
    Write the nested Map/List as json to the jsonGenerator.
    void
    write(Object object, Writer writer)
    Write the nested Map/List as json to the writer.
    void
    writeCollection(Collection<Object> collection, com.fasterxml.jackson.core.JsonGenerator jsonGenerator)
    Write the collection as json array to the jsonGenerator.

    Methods inherited from class Object

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

    • DJsonService

      public DJsonService()
  • Method Details

    • write

      public String write(Object object) throws IOException
      Write the nested Map/List as json.
      Specified by:
      write in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • write

      public void write(Object object, Writer writer) throws IOException
      Write the nested Map/List as json to the writer.
      Specified by:
      write in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • write

      public void write(Object object, com.fasterxml.jackson.core.JsonGenerator jsonGenerator) throws IOException
      Write the nested Map/List as json to the jsonGenerator.
      Specified by:
      write in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • writeCollection

      public void writeCollection(Collection<Object> collection, com.fasterxml.jackson.core.JsonGenerator jsonGenerator) throws IOException
      Write the collection as json array to the jsonGenerator.
      Specified by:
      writeCollection in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseObject

      public Map<String,Object> parseObject(String json, boolean modifyAware) throws IOException
      Parse the json and return as a Map additionally specifying if the returned map should be modify aware meaning that it can detect when it has been modified.
      Specified by:
      parseObject in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseObject

      public Map<String,Object> parseObject(String json) throws IOException
      Parse the json and return as a Map.
      Specified by:
      parseObject in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseObject

      public Map<String,Object> parseObject(Reader reader, boolean modifyAware) throws IOException
      Parse the json and return as a Map taking a reader.
      Specified by:
      parseObject in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseObject

      public Map<String,Object> parseObject(Reader reader) throws IOException
      Parse the json and return as a Map taking a reader.
      Specified by:
      parseObject in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseObject

      public Map<String,Object> parseObject(com.fasterxml.jackson.core.JsonParser parser) throws IOException
      Parse the json and return as a Map taking a JsonParser.
      Specified by:
      parseObject in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseObject

      public Map<String,Object> parseObject(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.core.JsonToken token) throws IOException
      Parse the json and return as a Map taking a JsonParser and a starting token.

      Used when the first token is checked to see if the value is null prior to calling this.

      Specified by:
      parseObject in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseList

      public <T> List<T> parseList(String json, boolean modifyAware) throws IOException
      Parse the json and return as a modify aware List.
      Specified by:
      parseList in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseList

      public List<Object> parseList(String json) throws IOException
      Parse the json and return as a List.
      Specified by:
      parseList in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseList

      public List<Object> parseList(Reader reader) throws IOException
      Parse the json and return as a List taking a Reader.
      Specified by:
      parseList in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseList

      public List<Object> parseList(com.fasterxml.jackson.core.JsonParser parser) throws IOException
      Parse the json and return as a List taking a JsonParser.
      Specified by:
      parseList in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseList

      public <T> List<T> parseList(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.core.JsonToken currentToken) throws IOException
      Parse the json returning as a List taking into account the current token.
      Specified by:
      parseList in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parse

      public Object parse(String json) throws IOException
      Parse the json and return as a List or Map.
      Specified by:
      parse in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parse

      public Object parse(Reader reader) throws IOException
      Parse the json and return as a List or Map.
      Specified by:
      parse in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parse

      public Object parse(com.fasterxml.jackson.core.JsonParser parser) throws IOException
      Parse the json and return as a List or Map.
      Specified by:
      parse in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseSet

      public <T> Set<T> parseSet(String json, boolean modifyAware) throws IOException
      Parse the json returning a Set that might be modify aware.
      Specified by:
      parseSet in interface io.ebean.service.SpiJsonService
      Throws:
      IOException
    • parseSet

      public <T> Set<T> parseSet(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.core.JsonToken currentToken) throws IOException
      Parse the json returning as a Set taking into account the current token.
      Specified by:
      parseSet in interface io.ebean.service.SpiJsonService
      Throws:
      IOException