Package com.contentstack.sdk
Class Group
java.lang.Object
com.contentstack.sdk.Group
Group is to get different types of DataType of data fromt the JSON response
-
Method Summary
Modifier and TypeMethodDescriptionGet object value for key.getAllEntries
(String refKey, String refContentType) Get value for the given reference key.Get an asset from the groupGet an assets from the group.getBoolean
(String key) Get boolean value for key.GetCalendar
value for keydouble
Get double value for keyfloat
Get integer value for keyGet a group from the group.Get a list of group from the group.int
Get integer value for keyorg.json.JSONArray
getJSONArray
(String key) GetJSONArray
value for keyorg.json.JSONObject
getJSONObject
(String key) GetJSONObject
value for keylong
Get long value for keyGetJSONObject
value for keyshort
Get short value for keyGet string value for key.org.json.JSONObject
toJSON()
Get group representation in json
-
Method Details
-
toJSON
public org.json.JSONObject toJSON()Get group representation in json- Returns:
- JSONObject
Example :
JSONObject json = group.toJSON();
-
get
Get object value for key.- Parameters:
key
- field_uid as key.- Returns:
- JSONObject
Example :
Object obj = group.get("key");
-
getString
Get string value for key.- Parameters:
key
- field_uid as key.- Returns:
- String
Example :
String value = group.getString("key");
-
getBoolean
Get boolean value for key.- Parameters:
key
- field_uid as key.- Returns:
- boolean true or false
Example :
Boolean value = group.getBoolean("key");
-
getJSONArray
GetJSONArray
value for key- Parameters:
key
- field_uid as key.- Returns:
- JSONArray
Example :
JSONArray value = group.getJSONArray("key");
-
getJSONObject
GetJSONObject
value for key- Parameters:
key
- field_uid as key.- Returns:
- JSONObject
Example :
JSONObject value = group.getJSONObject("key");
-
getNumber
GetJSONObject
value for key- Parameters:
key
- field_uid as key.- Returns:
- Number
Example :
JSONObject value = group.getJSONObject("key");
-
getInt
Get integer value for key- Parameters:
key
- field_uid as key.- Returns:
- int
Example :
int value = group.getInt("key");
-
getFloat
Get integer value for key- Parameters:
key
- field_uid as key.- Returns:
- float
Example :
float value = group.getFloat("key");
-
getDouble
Get double value for key- Parameters:
key
- field_uid as key.- Returns:
- double
Example :
double value = group.getDouble("key");
-
getLong
Get long value for key- Parameters:
key
- field_uid as key.- Returns:
- long
Example :
long value = group.getLong("key");
-
getShort
Get short value for key- Parameters:
key
- field_uid as key.- Returns:
- short
Example :
short value = group.getShort("key");
-
getDate
GetCalendar
value for key- Parameters:
key
- field_uid as key.- Returns:
Date
Example :
Calendar value = group.getDate("key");
-
getAsset
Get an asset from the group- Parameters:
key
- field_uid as key.- Returns:
- Asset object
Example :
Asset asset = group.getAsset("key");
-
getAssets
Get an assets from the group. This works with multiple true fields- Parameters:
key
- field_uid as key.
Example :
List<Asset> asset = group.getAssets("key");
- Returns:
- ArrayList of
Asset
-
getGroup
Get a group from the group.- Parameters:
key
- field_uid as key.
Example :
Group innerGroup = group.getGroup("key"); @return Group object
- Returns:
- the group
-
getGroups
Get a list of group from the group.Note :- This will work when group is multiple true.
- Parameters:
key
- field_uid as key.
Example :
Group innerGroup = group.getGroups("key");
- Returns:
- List of
Group
-
getAllEntries
Get value for the given reference key.
-