Class Json.DefaultFactory

java.lang.Object
org.infinispan.commons.dataconversion.internal.Json.DefaultFactory
All Implemented Interfaces:
Json.Factory
Enclosing class:
Json

public static class Json.DefaultFactory extends Object implements Json.Factory
  • Constructor Details

    • DefaultFactory

      public DefaultFactory()
  • Method Details

    • nil

      public Json nil()
      Description copied from interface: Json.Factory
      Construct and return an object representing JSON null. Implementations are free to cache a return the same instance. The resulting value must return true from isNull() and null from getValue().
      Specified by:
      nil in interface Json.Factory
      Returns:
      The representation of a JSON null value.
    • bool

      public Json bool(boolean x)
      Description copied from interface: Json.Factory
      Construct and return a JSON boolean. The resulting value must return true from isBoolean() and the passed in parameter from getValue().
      Specified by:
      bool in interface Json.Factory
      Parameters:
      x - The boolean value.
      Returns:
      A JSON with isBoolean() == true. Implementations are free to cache and return the same instance for true and false.
    • string

      public Json string(String x)
      Description copied from interface: Json.Factory
      Construct and return a JSON string. The resulting value must return true from isString() and the passed in parameter from getValue().
      Specified by:
      string in interface Json.Factory
      Parameters:
      x - The string to wrap as a JSON value.
      Returns:
      A JSON element with the given string as a value.
    • raw

      public Json raw(String x)
      Specified by:
      raw in interface Json.Factory
    • number

      public Json number(Number x)
      Description copied from interface: Json.Factory
      Construct and return a JSON number. The resulting value must return true from isNumber() and the passed in parameter from getValue().
      Specified by:
      number in interface Json.Factory
      Parameters:
      x - The numeric value.
      Returns:
      Json instance representing that value.
    • array

      public Json array()
      Description copied from interface: Json.Factory
      Construct and return a JSON object. The resulting value must return true from isArray() and an implementation of java.util.List from getValue().
      Specified by:
      array in interface Json.Factory
      Returns:
      An empty JSON array.
    • object

      public Json object()
      Description copied from interface: Json.Factory
      Construct and return a JSON object. The resulting value must return true from isObject() and an implementation of java.util.Map from getValue().
      Specified by:
      object in interface Json.Factory
      Returns:
      An empty JSON object.
    • make

      public Json make(Object anything)
      Description copied from interface: Json.Factory
      Construct and return a JSON object. The resulting value can be of any JSON type. The method is responsible for examining the type of its argument and performing an appropriate mapping to a Json instance.
      Specified by:
      make in interface Json.Factory
      Parameters:
      anything - An arbitray Java object from which to construct a Json element.
      Returns:
      The newly constructed Json instance.