com.netmera.mobile
Class BaseContent

java.lang.Object
  extended by com.netmera.mobile.BaseContent
Direct Known Subclasses:
NetmeraContent

public abstract class BaseContent
extends java.lang.Object


Constructor Summary
BaseContent()
           
 
Method Summary
 void add(java.lang.String key, java.lang.Object value)
          Adds key,value pairs into the object.
 java.lang.Object get(java.lang.String key)
          Gets the Object with the specified key.
 boolean getBoolean(java.lang.String key)
          Gets the boolean value with the specified key.
 double getDouble(java.lang.String key)
          Gets the double value with the specified key.
 int getInt(java.lang.String key)
          Gets the int value with the specified key.
 org.json.JSONArray getJSONArray(java.lang.String key)
          Gets the JSONArray object with the specified key.
 org.json.JSONObject getJSONObject(java.lang.String key)
          Gets the JSONObject object with the specified key.
 long getLong(java.lang.String key)
          Gets the long value with the specified key.
 NetmeraGeoLocation getNetmeraGeoLocation(java.lang.String key)
          Gets the NetmeraGeoLocation object with the specified key.
 NetmeraUser getNetmeraUser()
          Gets the NetmeraUser object
 java.lang.String getString(java.lang.String key)
          Gets the String object with the specified key.
 void increment(java.lang.String key, java.lang.Object value)
          Increments the value of a key of the corresponding NetmeraContent by a specified amount, if the content is not created yet or the content doesn't contain the given key, the increment values are used as initial values for the content.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseContent

public BaseContent()
Method Detail

add

public void add(java.lang.String key,
                java.lang.Object value)
         throws NetmeraException
Adds key,value pairs into the object. If the object contains key, the old value is replaced.

Parameters:
key - - key to identify specified value
value - - value associates with the specified key
Throws:
NetmeraException

increment

public void increment(java.lang.String key,
                      java.lang.Object value)
               throws NetmeraException
Increments the value of a key of the corresponding NetmeraContent by a specified amount, if the content is not created yet or the content doesn't contain the given key, the increment values are used as initial values for the content. If the content contains the given key, the value is incremented by a specified amount

Parameters:
key - - key to identify specified value
value - - value associates with the specified key
Throws:
NetmeraException - Throws exception if the value is not an instance of Number

get

public java.lang.Object get(java.lang.String key)
                     throws NetmeraException
Gets the Object with the specified key.

Parameters:
key - - key to get value
Returns:
Returns the Object with the specified key.If the object type is not Object or key does not exists then it returns null.
Throws:
NetmeraException - Throws exception if it cannot get object

getString

public java.lang.String getString(java.lang.String key)
                           throws NetmeraException
Gets the String object with the specified key.

Parameters:
key - - key to get value
Returns:
Returns the String with the specified key.If the object type is not String or key does not exists then it returns null.
Throws:
NetmeraException - Throws exception if it cannot get object

getInt

public int getInt(java.lang.String key)
           throws NetmeraException
Gets the int value with the specified key.

Parameters:
key - - key to get value
Returns:
Returns the int value with the specified key.If value is not an integer or key does not exists then it returns 0.
Throws:
NetmeraException - Throws exception if it cannot get object

getLong

public long getLong(java.lang.String key)
             throws NetmeraException
Gets the long value with the specified key.

Parameters:
key - - key to get value
Returns:
Returns the long value with the specified key.If value is not a long or key does not exists then it returns 0.
Throws:
NetmeraException - Throws exception if it cannot get object

getBoolean

public boolean getBoolean(java.lang.String key)
                   throws NetmeraException
Gets the boolean value with the specified key.

Parameters:
key - - key to get value
Returns:
Returns the boolean value with the specified key.If value is not a boolean or key does not exists then it returns false.
Throws:
NetmeraException - Throws exception if it cannot get object

getDouble

public double getDouble(java.lang.String key)
                 throws NetmeraException
Gets the double value with the specified key.

Parameters:
key - - key to get value
Returns:
Returns the double value with the specified key.If value is not a double or key does not exists then it returns 0.0.
Throws:
NetmeraException - Throws exception if it cannot get object

getJSONObject

public org.json.JSONObject getJSONObject(java.lang.String key)
                                  throws NetmeraException
Gets the JSONObject object with the specified key.

Parameters:
key - - key to get value
Returns:
Returns the JSONObject object with the specified key.If the object type is not an JSONObject or key does not exists then it returns null.
Throws:
NetmeraException - Throws exception if it cannot get object

getJSONArray

public org.json.JSONArray getJSONArray(java.lang.String key)
                                throws NetmeraException
Gets the JSONArray object with the specified key.

Parameters:
key - - key to get value
Returns:
Returns the JSONArray object with the specified key.If the object type is not an JSONArray or key does not exists then it returns null.
Throws:
NetmeraException - Throws exception if it cannot get object

getNetmeraGeoLocation

public NetmeraGeoLocation getNetmeraGeoLocation(java.lang.String key)
                                         throws NetmeraException
Gets the NetmeraGeoLocation object with the specified key.

Parameters:
key - key to get value
Returns:
Returns the NetmeraGeoLocation object with the specified key.If the object type is not an NetmeraGeoLocation or key does not exists then it returns null.
Throws:
NetmeraException - Throws exception if it cannot get object

getNetmeraUser

public NetmeraUser getNetmeraUser()
                           throws NetmeraException
Gets the NetmeraUser object

Returns:
Returns the NetmeraUser object with the specified key.If the object type is not an NetmeraUser or key does not exists then it returns null.
Throws:
NetmeraException - Throws exception if it cannot get object