playn.flash.json.impl
Class JreJsonFactory

java.lang.Object
  extended by playn.flash.json.impl.JreJsonFactory
All Implemented Interfaces:
JsonFactory

public class JreJsonFactory
extends Object
implements JsonFactory

Implementation of JsonFactory interface using org.json library.


Constructor Summary
JreJsonFactory()
           
 
Method Summary
 JsonBoolean create(boolean bool)
          Create a JsonBoolean from a Java boolean.
 JsonNumber create(double number)
          Create a JsonNumber from a Java double.
 JsonString create(String string)
          Create a JsonString from a Java String.
 JsonArray createArray()
          Create an empty JsonArray.
 JsonNull createNull()
          Create a JsonNull.
 JsonObject createObject()
          Create an empty JsonObject.
<T extends JsonValue>
T
parse(String jsonString)
          Parse a String in JSON format and return a JsonValue of the appropriate type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JreJsonFactory

public JreJsonFactory()
Method Detail

create

public JsonString create(String string)
Description copied from interface: JsonFactory
Create a JsonString from a Java String.

Specified by:
create in interface JsonFactory
Parameters:
string - a Java String
Returns:
the parsed JsonString

create

public JsonNumber create(double number)
Description copied from interface: JsonFactory
Create a JsonNumber from a Java double.

Specified by:
create in interface JsonFactory
Parameters:
number - a Java double
Returns:
the parsed JsonNumber

create

public JsonBoolean create(boolean bool)
Description copied from interface: JsonFactory
Create a JsonBoolean from a Java boolean.

Specified by:
create in interface JsonFactory
Parameters:
bool - a Java boolean
Returns:
the parsed JsonBoolean

createArray

public JsonArray createArray()
Description copied from interface: JsonFactory
Create an empty JsonArray.

Specified by:
createArray in interface JsonFactory
Returns:
a new JsonArray

createNull

public JsonNull createNull()
Description copied from interface: JsonFactory
Create a JsonNull.

Specified by:
createNull in interface JsonFactory
Returns:
a JsonNull instance

createObject

public JsonObject createObject()
Description copied from interface: JsonFactory
Create an empty JsonObject.

Specified by:
createObject in interface JsonFactory
Returns:
a new JsonObject

parse

public <T extends JsonValue> T parse(String jsonString)
                          throws JsonException
Description copied from interface: JsonFactory
Parse a String in JSON format and return a JsonValue of the appropriate type.

Specified by:
parse in interface JsonFactory
Parameters:
jsonString - a String in JSON format
Returns:
a parsed JsonValue
Throws:
JsonException


Copyright © 2011. All Rights Reserved.