Class StringJsonUtils

java.lang.Object
com.restfb.util.StringJsonUtils

public class StringJsonUtils extends Object
Helper class to encapsulate simple checks used in the DefaultJsonMapper.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isEmptyList(String jsonString)
    Is the given JSON equivalent to the empty list ([])?
    static boolean
    isEmptyObject(String jsonString)
    Is the given JSON equivalent to the empty object ({})?
    static boolean
    isFalse(String jsonString)
    Checks if the given String is equals to the String with the content "false"
    static boolean
    isList(String jsonString)
    Checks if the given String start with a [ character, so it may be a JsonArray
    static boolean
    isNull(String jsonString)
    Checks if the given String is equals to the String with the content "null"
    static boolean
    isObject(String jsonString)
    Checks if the given String start with a { character, so it may be a JsonObject

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • isEmptyList

      public static boolean isEmptyList(String jsonString)
      Is the given JSON equivalent to the empty list ([])?
      Parameters:
      jsonString - The JSON to check.
      Returns:
      true if the JSON is equivalent to the empty list, false otherwise.
    • isList

      public static boolean isList(String jsonString)
      Checks if the given String start with a [ character, so it may be a JsonArray
      Parameters:
      jsonString - the JSON to check.
      Returns:
      true if the String may be a JSON Array
    • isNull

      public static boolean isNull(String jsonString)
      Checks if the given String is equals to the String with the content "null"
      Parameters:
      jsonString - the JSON to check.
      Returns:
      true if the String is "null"
    • isFalse

      public static boolean isFalse(String jsonString)
      Checks if the given String is equals to the String with the content "false"
      Parameters:
      jsonString - the JSON to check.
      Returns:
      true if the String is "false"
    • isObject

      public static boolean isObject(String jsonString)
      Checks if the given String start with a { character, so it may be a JsonObject
      Parameters:
      jsonString - the JSON to check.
      Returns:
      true if the String may be a JSON object
    • isEmptyObject

      public static boolean isEmptyObject(String jsonString)
      Is the given JSON equivalent to the empty object ({})?
      Parameters:
      jsonString - The JSON to check.
      Returns:
      true if the JSON is equivalent to the empty object, false otherwise.