Package sk.antons.json
Class JsonFactory
- java.lang.Object
-
- sk.antons.json.JsonFactory
-
public class JsonFactory extends Object
Factory class for all relevant json instances.- Author:
- antons
-
-
Constructor Summary
Constructors Constructor Description JsonFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 JsonNullLiteralnullLiteral()Json 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.
-
-
-
Method Detail
-
array
public static JsonArray array()
Json array instance factory method.- Returns:
- new instance of json array.
-
object
public static JsonObject object()
Json object instance factory method.- Returns:
- new instance of json object.
-
nullLiteral
public static JsonNullLiteral nullLiteral()
Json null literal instance factory method.- Returns:
- new instance of json null literal.
-
boolLiteral
public static JsonBoolLiteral boolLiteral(boolean value)
Json boolean literal instance factory method.- Parameters:
value- internal value for new literal instance.- Returns:
- new instance of json boolean literal.
-
expLiteral
public static JsonExpLiteral expLiteral(BigDecimal value)
Json exponent literal instance factory method.- Parameters:
value- internal value for new literal instance.- Returns:
- new instance of json exponent literal.
-
fracLiteral
public static JsonFracLiteral fracLiteral(BigDecimal value)
Json fractional literal instance factory method.- Parameters:
value- internal value for new literal instance.- Returns:
- new instance of json fractional literal.
-
intLiteral
public static JsonIntLiteral intLiteral(long value)
Json integer literal instance factory method.- Parameters:
value- internal value for new literal instance.- Returns:
- new instance of json integer literal.
-
stringLiteral
public static JsonStringLiteral stringLiteral(String value)
Json string literal instance factory method.- Parameters:
value- internal value for new literal instance.- Returns:
- new instance of json string literal.
-
parseLiteral
public static JsonLiteral parseLiteral(String value)
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
-
-