public class JsJsonFactory extends Object implements JsonFactory
Constructor and Description |
---|
JsJsonFactory() |
Modifier and Type | Method and Description |
---|---|
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> |
parse(String jsonString)
Parse a String in JSON format and return a JsonValue of the appropriate
type.
|
public JsonString create(String string)
JsonFactory
create
in interface JsonFactory
string
- a Java Stringpublic JsonNumber create(double number)
JsonFactory
create
in interface JsonFactory
number
- a Java doublepublic JsonBoolean create(boolean bool)
JsonFactory
create
in interface JsonFactory
bool
- a Java booleanpublic JsonArray createArray()
JsonFactory
createArray
in interface JsonFactory
public JsonNull createNull()
JsonFactory
createNull
in interface JsonFactory
public JsonObject createObject()
JsonFactory
createObject
in interface JsonFactory
public <T extends JsonValue> T parse(String jsonString) throws JsonException
JsonFactory
parse
in interface JsonFactory
jsonString
- a String in JSON formatJsonException
Copyright © 2018. All rights reserved.