EZ JSON
by Nathanaël Cottin

org.ezjson
Class JSONObject

java.lang.Object
  extended by org.ezjson.JSONObject
All Implemented Interfaces:
java.lang.Iterable<java.lang.String>, JSONValue

public final class JSONObject
extends java.lang.Object
implements JSONValue, java.lang.Iterable<java.lang.String>

A JSON object is a (possibly empty) set of name/value pairs.
Note that this JSON object can be iterated over its internal names using a foreach construct

Author:
ncottin

Constructor Summary
JSONObject()
           
 
Method Summary
 boolean contains(java.lang.String name)
          Makes sure that this JSON object holds a name/value pair whose name equals the provided name
 JSONValue get(java.lang.String name)
           
 java.util.Iterator<java.lang.String> iterator()
           
 JSONValue put(java.lang.String name, JSONValue value)
          Adds a name/value pair to this JSON object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONObject

public JSONObject()
Method Detail

contains

public boolean contains(java.lang.String name)
Makes sure that this JSON object holds a name/value pair whose name equals the provided name

Parameters:
name - A non-null and non-empty name
Returns:
true only when this JSON object holds a name/value pair identified by the provided name

put

public JSONValue put(java.lang.String name,
                     JSONValue value)
Adds a name/value pair to this JSON object. Any existing pair with the same name is replaced by the provided pair

Parameters:
name - The non-null and non-empty name which identifies the corresponding value
value - A possibly null value
Returns:
The previous value associated with the provided name, or null if there was no mapping for the provided name

get

public JSONValue get(java.lang.String name)
Parameters:
name - A non-null and non-empty name
Returns:
The corresponding value when the provided name is registered, or null if no name/value pair identified by the provided name is found

iterator

public java.util.Iterator<java.lang.String> iterator()
Specified by:
iterator in interface java.lang.Iterable<java.lang.String>

EZ JSON
by Nathanaël Cottin