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.GetCalendarvalue for keydoubleGet double value for keyfloatGet integer value for keyGet a group from the group.Get a list of group from the group.intGet integer value for keyorg.json.JSONArraygetJSONArray(String key) GetJSONArrayvalue for keyorg.json.JSONObjectgetJSONObject(String key) GetJSONObjectvalue for keylongGet long value for keyGetJSONObjectvalue for keyshortGet short value for keyGet string value for key.org.json.JSONObjecttoJSON()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
GetJSONArrayvalue for key- Parameters:
key- field_uid as key.- Returns:
- JSONArray
Example :
JSONArray value = group.getJSONArray("key");
-
getJSONObject
GetJSONObjectvalue for key- Parameters:
key- field_uid as key.- Returns:
- JSONObject
Example :
JSONObject value = group.getJSONObject("key");
-
getNumber
GetJSONObjectvalue 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
GetCalendarvalue 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.
-