Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile
11g Release 2 (11.1.2.3.0)

E27204-01


oracle.adfmf.framework.api
Class JSONBeanSerializationHelper

java.lang.Object
  extended by oracle.adfmf.framework.api.JSONBeanSerializationHelper


public class JSONBeanSerializationHelper
extends java.lang.Object

JSONBeanSerializationHelper will (de)serialize objects in and out of a JSON object.

The following classes are used to support this functionality:

Supported types:

See Also:
JSONSerializable, PostJSONSerializable, JSONDeserializable, PostJSONDeserializable, ISO8601DateTimeUtil

Constructor Summary
JSONBeanSerializationHelper()
           

 

Method Summary
static java.lang.Object fromJSON(java.lang.Class type, java.lang.Object json)
          Method used to deserialize the passed-in Object to Java object.
static java.lang.Object fromJSON(java.lang.Class type, java.lang.String jsonString)
          Method used to deserialize the passed-in Object to Java object.
static boolean getBoolean(java.lang.Object object)
          Used to coerce an object into a boolean if possible.
static byte getByte(java.lang.Object object)
          Used to coerce an object into a byte if possible.
static char getCharacter(java.lang.Object object)
          Used to coerce an object into a char if possible.
static double getDouble(java.lang.Object object)
          Used to coerce an object into a double if possible.
static float getFloat(java.lang.Object object)
          Used to coerce an object into a float if possible.
static int getIdFromJSONObject(oracle.adfmf.json.JSONObject jsonObj)
          Gets id from the json object and returns the corresponding int value Internal Utility Function
static int getInteger(java.lang.Object object)
          Used to coerce an object into a int if possible.
static long getLong(java.lang.Object object)
          Used to coerce an object into a long if possible.
static short getShort(java.lang.Object object)
          Used to coerce an object into a short if possible.
static java.lang.String getString(java.lang.Object object)
          Used to coerce an object into a String if possible.
static boolean isObjectNull(java.lang.Object json)
          Utility method to determine if the JSON object is null.
static void removeBooleanFromJSON(oracle.adfmf.json.JSONObject jsonObj, boolean bValue, java.lang.String[] keys)
          Normalizes the JSON object by removing the objects which contain specified boolean value.
static void removeNegativesFromJSON(oracle.adfmf.json.JSONObject jsonObj, java.lang.String[] keys)
          Normalizes the JSON object by removing the objects which contain value: -1.
static void removeNullsFromJSON(oracle.adfmf.json.JSONObject jsonObj, java.lang.String[] keys)
          Normalizes the JSON object by removing the objects which contain null's.
static java.lang.Object toJSON(java.lang.Object obj)
          Method used to serialize the passed in Java object to JSON.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

JSONBeanSerializationHelper

public JSONBeanSerializationHelper()

Method Detail

fromJSON

public static java.lang.Object fromJSON(java.lang.Class type,
                                        java.lang.String jsonString)
                                 throws java.lang.Exception
Method used to deserialize the passed-in Object to Java object. This is the same as calling
JSONBeanSerializationHelper.fromJSON(type, new JSONObject(jsonString));
Parameters:
type - Class to which JSON Object should be deserialized to
jsonString - String representing a JSON object.
Throws:
java.lang.Exception

fromJSON

public static java.lang.Object fromJSON(java.lang.Class type,
                                        java.lang.Object json)
                                 throws java.lang.Exception
Method used to deserialize the passed-in Object to Java object.

Please refer to the following for more advanced ideas:

The basic deserialize method provide the following out of the box conversions: For additional details, please refer to JSONBeanSerializationHelper for details of all object types.
Parameters:
type - Class to which JSON Object should be deserialized to
json - Object to be deserialized
Returns:
Java Object for the corresponding object passed in. (This java object is of type 'class' passed in.)
Throws:
java.lang.Exception
See Also:
JSONDeserializable, PostJSONDeseralizable, JSONBeanSerializationHelper, ISO8601DateTimeUtil

toJSON

public static java.lang.Object toJSON(java.lang.Object obj)
                               throws java.lang.Exception
Method used to serialize the passed in Java object to JSON.

Please refer to the following for more advanced ideas:

The basic deserialize method provide the following out of the box conversions: For additional details, please refer to JSONBeanSerializationHelper for details of all object types.
Parameters:
obj - Object to be serialized
Returns:
Object
Throws:
java.lang.Exception
See Also:
JSONSerializable, PostJSONSerializable

isObjectNull

public static boolean isObjectNull(java.lang.Object json)
Utility method to determine if the JSON object is null. Internal Utility Function

removeNullsFromJSON

public static void removeNullsFromJSON(oracle.adfmf.json.JSONObject jsonObj,
                                       java.lang.String[] keys)
Normalizes the JSON object by removing the objects which contain null's. Internal Utility Function

removeNegativesFromJSON

public static void removeNegativesFromJSON(oracle.adfmf.json.JSONObject jsonObj,
                                           java.lang.String[] keys)
Normalizes the JSON object by removing the objects which contain value: -1. Internal Utility Function

removeBooleanFromJSON

public static void removeBooleanFromJSON(oracle.adfmf.json.JSONObject jsonObj,
                                         boolean bValue,
                                         java.lang.String[] keys)
Normalizes the JSON object by removing the objects which contain specified boolean value. Internal Utility Function

getIdFromJSONObject

public static int getIdFromJSONObject(oracle.adfmf.json.JSONObject jsonObj)
                               throws oracle.adfmf.json.JSONException
Gets id from the json object and returns the corresponding int value Internal Utility Function
Throws:
oracle.adfmf.json.JSONException

getBoolean

public static boolean getBoolean(java.lang.Object object)
                          throws java.lang.Exception
Used to coerce an object into a boolean if possible.
Parameters:
object - to coerce
Returns:
the coerced value
Throws:
java.lang.Exception

getByte

public static byte getByte(java.lang.Object object)
Used to coerce an object into a byte if possible.
Parameters:
object - to coerce
Returns:
the coerced value
Throws:
java.lang.Exception

getCharacter

public static char getCharacter(java.lang.Object object)
Used to coerce an object into a char if possible.
Parameters:
object - to coerce
Returns:
the coerced value
Throws:
java.lang.Exception

getDouble

public static double getDouble(java.lang.Object object)
Used to coerce an object into a double if possible.
Parameters:
object - to coerce
Returns:
the coerced value
Throws:
java.lang.Exception

getFloat

public static float getFloat(java.lang.Object object)
Used to coerce an object into a float if possible.
Parameters:
object - to coerce
Returns:
the coerced value
Throws:
java.lang.Exception

getInteger

public static int getInteger(java.lang.Object object)
Used to coerce an object into a int if possible.
Parameters:
object - to coerce
Returns:
the coerced value
Throws:
java.lang.Exception

getLong

public static long getLong(java.lang.Object object)
Used to coerce an object into a long if possible.
Parameters:
object - to coerce
Returns:
the coerced value
Throws:
java.lang.Exception

getShort

public static short getShort(java.lang.Object object)
Used to coerce an object into a short if possible.
Parameters:
object - to coerce
Returns:
the coerced value
Throws:
java.lang.Exception

getString

public static java.lang.String getString(java.lang.Object object)
Used to coerce an object into a String if possible.
Parameters:
object - to coerce
Returns:
the coerced value
Throws:
java.lang.Exception

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile
11g Release 2 (11.1.2.3.0)

E27204-01


Copyright © 2012 Oracle. All Rights Reserved.