VMware GemFire Java API Reference
Package org.apache.geode.json
Interface JsonDocumentFactory
-
public interface JsonDocumentFactory
Interface that creates aJsonDocument
from a JSON string. To obtain an instance, useRegionService.getJsonDocumentFactory()
orRegionService.getJsonDocumentFactory(StorageFormat)
. WhenDocument.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:- JSON Object: JsonDocument
- JSON Array: List
- JSON String: String
- JSON "true": Boolean.TRUE
- JSON "false": Boolean.FALSE
- JSON "null": null
- JSON Number: Integer, Long, BigInteger, or Double (depending on the value;
note that Byte and Short are also used if
StorageFormat.PDX
)
RegionService
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JsonDocument
create(java.lang.String json)
Convert the JSON string to a JsonDocument.
-
-
-
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.
-
-