Class CommonJsonBuilder


  • public final class CommonJsonBuilder
    extends Object
    Common IJsonBuilder implementations for widely-used libraries.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static IJsonBuilder<com.alibaba.fastjson.JSONArray,​com.alibaba.fastjson.JSONObject> fastJson()
      Gets a JSON builder for the FastJson library.
      static IJsonBuilder<com.google.gson.JsonArray,​com.google.gson.JsonObject> gson()
      Gets a JSON builder for the Gson library.
      static IJsonBuilder<com.google.gson.JsonArray,​com.google.gson.JsonObject> gson​(com.google.gson.Gson gson)
      Gets a JSON builder for the Gson library.
      static IJsonBuilder<com.fasterxml.jackson.databind.node.ArrayNode,​com.fasterxml.jackson.databind.node.ObjectNode> jackson()
      Gets a JSON builder for the Jackson library.
      static IJsonBuilder<com.fasterxml.jackson.databind.node.ArrayNode,​com.fasterxml.jackson.databind.node.ObjectNode> jackson​(com.fasterxml.jackson.databind.node.JsonNodeFactory factory, com.fasterxml.jackson.databind.ObjectMapper mapper)
      Gets a JSON builder for the Jackson library.
      static IJsonBuilder<org.json.JSONArray,​org.json.JSONObject> orgJson()
      Gets a JSON builder for the org.json library.
    • Method Detail

      • fastJson

        public static IJsonBuilder<com.alibaba.fastjson.JSONArray,​com.alibaba.fastjson.JSONObject> fastJson()
        Gets a JSON builder for the FastJson library.
        Returns:
        A JSON builder for the FastJson library.
      • gson

        public static IJsonBuilder<com.google.gson.JsonArray,​com.google.gson.JsonObject> gson()
        Gets a JSON builder for the Gson library.
        Returns:
        A JSON builder for the Gson library.
      • gson

        public static IJsonBuilder<com.google.gson.JsonArray,​com.google.gson.JsonObject> gson​(com.google.gson.Gson gson)
        Gets a JSON builder for the Gson library.
        Parameters:
        gson - The GSON instance to use.
        Returns:
        A JSON builder for the Gson library.
      • jackson

        public static IJsonBuilder<com.fasterxml.jackson.databind.node.ArrayNode,​com.fasterxml.jackson.databind.node.ObjectNode> jackson()
        Gets a JSON builder for the Jackson library.
        Returns:
        A JSON builder for the Jackson library.
      • jackson

        public static IJsonBuilder<com.fasterxml.jackson.databind.node.ArrayNode,​com.fasterxml.jackson.databind.node.ObjectNode> jackson​(com.fasterxml.jackson.databind.node.JsonNodeFactory factory,
                                                                                                                                               com.fasterxml.jackson.databind.ObjectMapper mapper)
        Gets a JSON builder for the Jackson library.
        Parameters:
        factory - The JSON node factory to use.
        mapper - The JSON object mapper to use.
        Returns:
        A JSON builder for the Jackson library.
      • orgJson

        public static IJsonBuilder<org.json.JSONArray,​org.json.JSONObject> orgJson()
        Gets a JSON builder for the org.json library.
        Returns:
        A JSON builder for the org.json library.