GemFire 7.0.1

com.gemstone.gemfire.pdx
Class JSONFormatter

java.lang.Object
  extended by com.gemstone.gemfire.pdx.JSONFormatter

public class JSONFormatter
extends Object

PdxFormatter class has static methods to convert JSON document into PdxInstance and methods to convert back PdxInstance into JSON Document. Using this, application can put json document in gemfire cache. Application can define indexes on PdxInsatnce and then query those using OQL. Query will return the PdxInstances as results, that needs to convert back into JSON document. This uses Jackson parser to parse the json document. Parser treats values in json document as number(byte, short, int, long..), string, array, object, 'true', 'false' or 'null'. Which further treated as corresponding java types in PdxInstance JSON objects are converted into PdxInstance JSON arrays are converted into List.


Field Summary
static String JSON_CLASSNAME
           
 
Method Summary
static PdxInstance fromJSON(byte[] jsonByteArray)
          To create PdxInstance from JSON string
static PdxInstance fromJSON(String jsonString)
          To create PdxInstance from JSON string
static String toJSON(PdxInstance pdxInstance)
          To create JSON string from PdxInstance
static byte[] toJSONByteArray(PdxInstance pdxInstance)
          To create JSON byte array from PdxInstance
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JSON_CLASSNAME

public static final String JSON_CLASSNAME
See Also:
Constant Field Values
Method Detail

fromJSON

public static PdxInstance fromJSON(String jsonString)
To create PdxInstance from JSON string

Returns:
the PdxInstance.
Throws:
JSONFormatterException - if unable to parse JSON doucment

fromJSON

public static PdxInstance fromJSON(byte[] jsonByteArray)
To create PdxInstance from JSON string

Returns:
the PdxInstance.
Throws:
JSONFormatterException - if unable to parse JSON doucment

toJSON

public static String toJSON(PdxInstance pdxInstance)
To create JSON string from PdxInstance

Returns:
the JSON string.
Throws:
JSONFormatterException - if unable to create JSON doucment from PdxInstance

toJSONByteArray

public static byte[] toJSONByteArray(PdxInstance pdxInstance)
To create JSON byte array from PdxInstance

Returns:
the JSON byte array.
Throws:
JSONFormatterException - if unable to create JSON doucment from PdxInstance

GemFire 7.0.1

Copyright © 1997-2013 VMware, Inc. All rights reserved.