org.apache.openjpa.persistence.jest
Class JSONObject

java.lang.Object
  extended by org.apache.openjpa.persistence.jest.JSONObject
All Implemented Interfaces:
JSON

public class JSONObject
extends Object
implements JSON

A JSON instance for persistence.
Persistent instances have a persistent identity that extends beyond the process lifetime unlike other common identity such as identity hash code for a Java instance in a JVM.
A JSONObject instance must need such a persistent identity.

Author:
Pinaki Poddar

Nested Class Summary
static class JSONObject.Array
          An array of objects.
static class JSONObject.KVMap
          A map whose key or value can be JSON.
 
Field Summary
 
Fields inherited from interface org.apache.openjpa.persistence.jest.JSON
ARRAY_EMPTY, ARRAY_END, ARRAY_START, FIELD_SEPARATOR, ID_MARKER, IOR_SEPARTOR, MEMBER_SEPARATOR, NEWLINE, NULL_LITERAL, OBJECT_END, OBJECT_START, QUOTE, REF_MARKER, SPACE, VALUE_SEPARATOR
 
Constructor Summary
JSONObject(String type, Object id, boolean ref)
           
 
Method Summary
 StringBuilder asString(int indent)
          Render into a string buffer.
(package private)  StringBuilder ior()
           
static void main(String[] args)
           
 void set(String key, Object value)
           
 String toString()
           
 void write(PrintWriter writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSONObject

public JSONObject(String type,
                  Object id,
                  boolean ref)
Method Detail

set

public void set(String key,
                Object value)

write

public void write(PrintWriter writer)

toString

public String toString()
Overrides:
toString in class Object

asString

public StringBuilder asString(int indent)
Description copied from interface: JSON
Render into a string buffer.

Specified by:
asString in interface JSON
Parameters:
indent - level at which this instance is being rendered
Returns:
a mutable buffer

ior

StringBuilder ior()

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.