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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJsonUtils.JsonTokenTypes of Json tokens.static classJsonUtils.Types
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetJsonString(String string)Transform Java String to JSON string.static JsonUtils.TypesgetType(Class<?> clazz)Get correspondingJsonUtils.Typesfor specified class.static JsonUtils.TypesgetType(Object o)Get correspondingJsonUtils.Typesfor specified Object.static booleanisKnownType(Class<?> clazz)Check is given class object represents: Primitive type Primitive type wrapper String Array of T where T satisfies 1 or 2 or 3static booleanisKnownType(Object o)Check is given object has on of types:nullPrimitive type Primitive type wrapper String Array of T where T satisfies 2 or 3 or 4
-
-
-
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:null- Primitive type
- Primitive type wrapper
- String
- Array of T where T satisfies 2 or 3 or 4
- Parameters:
o- Object- Returns:
trueif Object has one of described above type,falseotherwise
-
isKnownType
public 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
- Parameters:
clazz- class.- Returns:
trueif class object represent one of described above,falseotherwise
-
getType
public static JsonUtils.Types getType(Object o)
Get correspondingJsonUtils.Typesfor specified Object. If object is NOT :- Known type (primitive, String, array of primitive or String)
- Array
- Collection<?>
- Map<String, ?>
nullwill be returned- Parameters:
o- Object.- Returns:
JsonUtils.Typesornull(see above)- See Also:
KNOWN_TYPES
-
getType
public static JsonUtils.Types getType(Class<?> clazz)
Get correspondingJsonUtils.Typesfor specified class. If class object is NOT :- Known type (primitive, String, array of primitive or String)
- Array
- Collection
- Map
nullwill be returned- Parameters:
clazz- Object.- Returns:
JsonUtils.Typesornull(see above)- See Also:
KNOWN_TYPES
-
-