Class JsonUtils

java.lang.Object
org.exoplatform.ws.frameworks.json.impl.JsonUtils

public final class JsonUtils extends Object
Version:
$Id: JsonUtils.java 34417 2009-07-23 14:42:56Z dkatayev $
Author:
Andrey Parfonov
  • Method Details

    • getJsonString

      public static String getJsonString(String string)
      Transform Java String to JSON string.
      Parameters:
      string - source String.
      Returns:
      result.
    • isKnownType

      public static boolean isKnownType(Object o)
      Check is given object has on of types:
      1. null
      2. Primitive type
      3. Primitive type wrapper
      4. String
      5. Array of T where T satisfies 2 or 3 or 4
      Parameters:
      o - Object
      Returns:
      true if Object has one of described above type, false otherwise
    • isKnownType

      public static boolean isKnownType(Class<?> clazz)
      Check is given class object represents:
      1. Primitive type
      2. Primitive type wrapper
      3. String
      4. Array of T where T satisfies 1 or 2 or 3
      Parameters:
      clazz - class.
      Returns:
      true if class object represent one of described above, false otherwise
    • getType

      public static JsonUtils.Types getType(Object o)
      Get corresponding JsonUtils.Types for specified Object. If object is NOT :
      1. Known type (primitive, String, array of primitive or String)
      2. Array
      3. Collection<?>
      4. Map<String, ?>
      then null will be returned
      Parameters:
      o - Object.
      Returns:
      JsonUtils.Types or null (see above)
      See Also:
      • KNOWN_TYPES
    • getType

      public static JsonUtils.Types getType(Class<?> clazz)
      Get corresponding JsonUtils.Types for specified class. If class object is NOT :
      1. Known type (primitive, String, array of primitive or String)
      2. Array
      3. Collection
      4. Map
      then null will be returned
      Parameters:
      clazz - Object.
      Returns:
      JsonUtils.Types or null (see above)
      See Also:
      • KNOWN_TYPES