Package sk.antons.json
Class JsonFactory
java.lang.Object
sk.antons.json.JsonFactory
Factory class for all relevant json instances.
- Author:
- antons
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonArrayarray()Json array instance factory method.static JsonBoolLiteralboolLiteral(boolean value) Json boolean literal instance factory method.static JsonExpLiteralexpLiteral(BigDecimal value) Json exponent literal instance factory method.static JsonFracLiteralfracLiteral(BigDecimal value) Json fractional literal instance factory method.static JsonIntLiteralintLiteral(long value) Json integer literal instance factory method.static JsonNullLiteralJson null literal instance factory method.static JsonObjectobject()Json object instance factory method.static JsonLiteralparseLiteral(String value) Parse string value and return identified literal.static JsonStringLiteralstringLiteral(String value) Json string literal instance factory method.static JsonStringLiteralstringLiteral(String value, boolean escapeNonAscii) Json string literal instance factory method.
-
Constructor Details
-
JsonFactory
public JsonFactory()
-
-
Method Details
-
array
Json array instance factory method.- Returns:
- new instance of json array.
-
object
Json object instance factory method.- Returns:
- new instance of json object.
-
nullLiteral
Json null literal instance factory method.- Returns:
- new instance of json null literal.
-
boolLiteral
Json boolean literal instance factory method.- Parameters:
value- internal value for new literal instance.- Returns:
- new instance of json boolean literal.
-
expLiteral
Json exponent literal instance factory method.- Parameters:
value- internal value for new literal instance.- Returns:
- new instance of json exponent literal.
-
fracLiteral
Json fractional literal instance factory method.- Parameters:
value- internal value for new literal instance.- Returns:
- new instance of json fractional literal.
-
intLiteral
Json integer literal instance factory method.- Parameters:
value- internal value for new literal instance.- Returns:
- new instance of json integer literal.
-
stringLiteral
Json string literal instance factory method.- Parameters:
value- internal value for new literal instance.- Returns:
- new instance of json string literal.
-
stringLiteral
Json string literal instance factory method.- Parameters:
value- internal value for new literal instance.escapeNonAscii- true is non ascii chars must be exaped to form- Returns:
- new instance of json string literal.
-
parseLiteral
Parse string value and return identified literal. (remember that string literals are enclosed with quotas like "foo")- Parameters:
value- string representation of literal (like "foo", null, true, 123213, 12.4, 12E-1)- Returns:
- JsonLiteral instance
-