Class JsonFactory

java.lang.Object
sk.antons.json.JsonFactory

public class JsonFactory extends Object
Factory class for all relevant json instances.
Author:
antons
  • Constructor Details

    • JsonFactory

      public JsonFactory()
  • Method Details

    • 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.
    • stringLiteral

      public static JsonStringLiteral stringLiteral(String value, boolean escapeNonAscii)
      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

      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