playn.flash.json
Interface JsonFactory

All Known Implementing Classes:
JreJsonFactory

public interface JsonFactory

Factory interface for parsing and creating JSON objects.


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.
 

Method Detail

create

JsonString create(String string)
Create a JsonString from a Java String.

Parameters:
string - a Java String
Returns:
the parsed JsonString

create

JsonNumber create(double number)
Create a JsonNumber from a Java double.

Parameters:
number - a Java double
Returns:
the parsed JsonNumber

create

JsonBoolean create(boolean bool)
Create a JsonBoolean from a Java boolean.

Parameters:
bool - a Java boolean
Returns:
the parsed JsonBoolean

createArray

JsonArray createArray()
Create an empty JsonArray.

Returns:
a new JsonArray

createNull

JsonNull createNull()
Create a JsonNull.

Returns:
a JsonNull instance

createObject

JsonObject createObject()
Create an empty JsonObject.

Returns:
a new JsonObject

parse

<T extends JsonValue> T parse(String jsonString)
                          throws JsonException
Parse a String in JSON format and return a JsonValue of the appropriate type.

Parameters:
jsonString - a String in JSON format
Returns:
a parsed JsonValue
Throws:
JsonException


Copyright © 2011. All Rights Reserved.