Interface JsonDocumentFactory


  • public interface JsonDocumentFactory
    Interface that creates a JsonDocument from a JSON string. To obtain an instance, use RegionService.getJsonDocumentFactory() or RegionService.getJsonDocumentFactory(StorageFormat). When Document.getField(String) is called on the documents created by this factory an object is returned. The type of that object depends on how this factory maps JSON elements to a Java type. The mappings are:
    1. JSON Object: JsonDocument
    2. JSON Array: List
    3. JSON String: String
    4. JSON "true": Boolean.TRUE
    5. JSON "false": Boolean.FALSE
    6. JSON "null": null
    7. JSON Number: Integer, Long, BigInteger, or Double (depending on the value; note that Byte and Short are also used if StorageFormat.PDX)
    The implementors of this interface are thread safe and create can be called multiple times on the same factory obtained from the RegionService.
    • Method Detail

      • create

        JsonDocument create​(java.lang.String json)
                     throws JsonParseException
        Convert the JSON string to a JsonDocument. The JSON string must be a single "JSON object." A JSON object is an unordered set of name/value pairs. An object begins with a left brace and ends with a right brace. Each name is followed by a colon and the name/value pairs are separated by a comma.
        Parameters:
        json - the JSON String to convert to JsonDocument.
        Returns:
        the JsonDocument.
        Throws:
        JsonParseException - if the string does not contain a single JSON object.