Module io.ebean.api

Class EJson

java.lang.Object
io.ebean.text.json.EJson

public class EJson extends Object
Utility that converts between JSON content and simple java Maps/Lists.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Object
    parse(com.fasterxml.jackson.core.JsonParser parser)
    Parse the json and return as a List or Map.
    static Object
    parse(Reader reader)
    Parse the json and return as a List or Map.
    static Object
    parse(String json)
    Parse the json and return as a List or Map.
    static List<Object>
    parseList(com.fasterxml.jackson.core.JsonParser parser)
    Parse the json and return as a List taking a JsonParser.
    static <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.
    static List<Object>
    parseList(Reader reader)
    Parse the json and return as a List taking a Reader.
    static List<Object>
    Parse the json and return as a List.
    static <T> List<T>
    parseList(String json, boolean modifyAware)
    Parse the json and return as a modify aware List.
    static Map<String,Object>
    parseObject(com.fasterxml.jackson.core.JsonParser parser)
    Parse the json and return as a Map taking a JsonParser.
    static Map<String,Object>
    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.
    static Map<String,Object>
    Parse the json and return as a Map taking a reader.
    static Map<String,Object>
    parseObject(Reader reader, boolean modifyAware)
    Parse the json and return as a Map taking a reader.
    static Map<String,Object>
    Parse the json and return as a Map.
    static Map<String,Object>
    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.
    static <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.
    static <T> Set<T>
    parseSet(String json, boolean modifyAware)
    Parse the json returning a Set that might be modify aware.
    static String
    write(Object object)
    Write the nested Map/List as json.
    static void
    write(Object object, com.fasterxml.jackson.core.JsonGenerator jsonGenerator)
    Write the nested Map/List as json to the jsonGenerator.
    static void
    write(Object object, Writer writer)
    Write the nested Map/List as json to the writer.
    static void
    writeCollection(Collection<Object> collection, com.fasterxml.jackson.core.JsonGenerator jsonGenerator)
    Write the collection as json array to the jsonGenerator.

    Methods inherited from class java.lang.Object

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

    • EJson

      public EJson()
  • Method Details

    • write

      public static String write(Object object) throws IOException
      Write the nested Map/List as json.
      Throws:
      IOException
    • write

      public static void write(Object object, Writer writer) throws IOException
      Write the nested Map/List as json to the writer.
      Throws:
      IOException
    • write

      public static void write(Object object, com.fasterxml.jackson.core.JsonGenerator jsonGenerator) throws IOException
      Write the nested Map/List as json to the jsonGenerator.
      Throws:
      IOException
    • writeCollection

      public static void writeCollection(Collection<Object> collection, com.fasterxml.jackson.core.JsonGenerator jsonGenerator) throws IOException
      Write the collection as json array to the jsonGenerator.
      Throws:
      IOException
    • parseObject

      public static 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.
      Throws:
      IOException
    • parseObject

      public static Map<String,Object> parseObject(String json) throws IOException
      Parse the json and return as a Map.
      Throws:
      IOException
    • parseObject

      public static Map<String,Object> parseObject(Reader reader, boolean modifyAware) throws IOException
      Parse the json and return as a Map taking a reader.
      Throws:
      IOException
    • parseObject

      public static Map<String,Object> parseObject(Reader reader) throws IOException
      Parse the json and return as a Map taking a reader.
      Throws:
      IOException
    • parseObject

      public static Map<String,Object> parseObject(com.fasterxml.jackson.core.JsonParser parser) throws IOException
      Parse the json and return as a Map taking a JsonParser.
      Throws:
      IOException
    • parseObject

      public static 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.

      Throws:
      IOException
    • parseList

      public static <T> List<T> parseList(String json, boolean modifyAware) throws IOException
      Parse the json and return as a modify aware List.
      Throws:
      IOException
    • parseList

      public static List<Object> parseList(String json) throws IOException
      Parse the json and return as a List.
      Throws:
      IOException
    • parseList

      public static List<Object> parseList(Reader reader) throws IOException
      Parse the json and return as a List taking a Reader.
      Throws:
      IOException
    • parseList

      public static List<Object> parseList(com.fasterxml.jackson.core.JsonParser parser) throws IOException
      Parse the json and return as a List taking a JsonParser.
      Throws:
      IOException
    • parseList

      public static <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.
      Throws:
      IOException
    • parse

      public static Object parse(String json) throws IOException
      Parse the json and return as a List or Map.
      Throws:
      IOException
    • parse

      public static Object parse(Reader reader) throws IOException
      Parse the json and return as a List or Map.
      Throws:
      IOException
    • parse

      public static Object parse(com.fasterxml.jackson.core.JsonParser parser) throws IOException
      Parse the json and return as a List or Map.
      Throws:
      IOException
    • parseSet

      public static <T> Set<T> parseSet(String json, boolean modifyAware) throws IOException
      Parse the json returning a Set that might be modify aware.
      Throws:
      IOException
    • parseSet

      public static <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.
      Throws:
      IOException