Class JreJsonFactory

  • All Implemented Interfaces:
    JsonFactory

    public class JreJsonFactory
    extends Object
    implements JsonFactory
    Implementation of JsonFactory interface using org.json library.
    • Constructor Detail

      • JreJsonFactory

        public JreJsonFactory()
    • Method Detail

      • create

        public JsonString create​(String string)
        Description copied from interface: JsonFactory
        Create a JsonString from a Java String.
        Specified by:
        create in interface JsonFactory
        Parameters:
        string - a Java String
        Returns:
        the parsed JsonString
      • create

        public JsonNumber create​(double number)
        Description copied from interface: JsonFactory
        Create a JsonNumber from a Java double.
        Specified by:
        create in interface JsonFactory
        Parameters:
        number - a Java double
        Returns:
        the parsed JsonNumber
      • create

        public JsonBoolean create​(boolean bool)
        Description copied from interface: JsonFactory
        Create a JsonBoolean from a Java boolean.
        Specified by:
        create in interface JsonFactory
        Parameters:
        bool - a Java boolean
        Returns:
        the parsed JsonBoolean
      • parse

        public <T extends JsonValue> T parse​(String jsonString)
                                      throws JsonException
        Description copied from interface: JsonFactory
        Parse a String in JSON format and return a JsonValue of the appropriate type.
        Specified by:
        parse in interface JsonFactory
        Parameters:
        jsonString - a String in JSON format
        Returns:
        a parsed JsonValue
        Throws:
        JsonException