eXo WS :: Framework :: JSON 2.4.0-Alpha1

org.exoplatform.ws.frameworks.json.impl
Class JsonUtils

java.lang.Object
  extended by 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

Nested Class Summary
static class JsonUtils.JsonToken
          Types of Json tokens.
static class JsonUtils.Types
           
 
Method Summary
static String getJsonString(String string)
          Transform Java String to JSON string.
static JsonUtils.Types getType(Class<?> clazz)
          Get corresponding JsonUtils.Types for specified class.
static JsonUtils.Types getType(Object o)
          Get corresponding JsonUtils.Types for specified Object.
static boolean isKnownType(Class<?> clazz)
          Check is given class object represents: Primitive type Primitive type wrapper String Array of T where T satisfies 1 or 2 or 3
static boolean isKnownType(Object o)
          Check is given object has on of types: null Primitive type Primitive type wrapper String Array of T where T satisfies 2 or 3 or 4
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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:
o - Object.
Returns:
JsonUtils.Types or null (see above)
See Also:
KNOWN_TYPES}.

eXo WS :: Framework :: JSON 2.4.0-Alpha1

Copyright © 2013 eXo Platform SAS. All Rights Reserved.