Package com.contentstack.sdk
Class Group
- java.lang.Object
-
- com.contentstack.sdk.Group
-
public class Group extends Object
-
-
Method Summary
Modifier and Type Method Description Objectget(String key)Get object value for key.ArrayList<Entry>getAllEntries(String refKey, String refContentType)Get value for the given reference key.AssetgetAsset(String key)Get an asset from the groupList<Asset>getAssets(String key)Get an assets from the group.BooleangetBoolean(String key)Get boolean value for key.CalendargetDate(String key)GetCalendarvalue for keydoublegetDouble(String key)Get double value for keyfloatgetFloat(String key)Get integer value for keyGroupgetGroup(String key)Get a group from the group.List<Group>getGroups(String key)Get a list of group from the group.intgetInt(String key)Get integer value for keyorg.json.JSONArraygetJSONArray(String key)GetJSONArrayvalue for keyorg.json.JSONObjectgetJSONObject(String key)GetJSONObjectvalue for keylonggetLong(String key)Get long value for keyNumbergetNumber(String key)GetJSONObjectvalue for keyshortgetShort(String key)Get short value for keyStringgetString(String key)Get string value for key.org.json.JSONObjecttoJSON()Get group representation in json
-
-
-
Constructor Detail
-
Group
protected Group(Stack stack, org.json.JSONObject jsonObject)
-
-
Method Detail
-
toJSON
public org.json.JSONObject toJSON()
Get group representation in json- Returns:
- JSONObject
Example :
JSONObject json = group.toJSON();
-
get
public Object get(String key)
Get object value for key.- Parameters:
key- field_uid as key.- Returns:
- JSONObject
Example :
Object obj = group.get("key");
-
getString
public String getString(String key)
Get string value for key.- Parameters:
key- field_uid as key.- Returns:
- String
Example :
String value = group.getString("key");
-
getBoolean
public Boolean getBoolean(String key)
Get boolean value for key.- Parameters:
key- field_uid as key.- Returns:
- boolean true or false
Example :
Boolean value = group.getBoolean("key");
-
getJSONArray
public org.json.JSONArray getJSONArray(String key)
GetJSONArrayvalue for key- Parameters:
key- field_uid as key.- Returns:
- JSONArray
Example :
JSONArray value = group.getJSONArray("key");
-
getJSONObject
public org.json.JSONObject getJSONObject(String key)
GetJSONObjectvalue for key- Parameters:
key- field_uid as key.- Returns:
- JSONObject
Example :
JSONObject value = group.getJSONObject("key");
-
getNumber
public Number getNumber(String key)
GetJSONObjectvalue for key- Parameters:
key- field_uid as key.- Returns:
- Number
Example :
JSONObject value = group.getJSONObject("key");
-
getInt
public int getInt(String key)
Get integer value for key- Parameters:
key- field_uid as key.- Returns:
- int
Example :
int value = group.getInt("key");
-
getFloat
public float getFloat(String key)
Get integer value for key- Parameters:
key- field_uid as key.- Returns:
- float
Example :
float value = group.getFloat("key");
-
getDouble
public double getDouble(String key)
Get double value for key- Parameters:
key- field_uid as key.- Returns:
- double
Example :
double value = group.getDouble("key");
-
getLong
public long getLong(String key)
Get long value for key- Parameters:
key- field_uid as key.- Returns:
- long
Example :
long value = group.getLong("key");
-
getShort
public short getShort(String key)
Get short value for key- Parameters:
key- field_uid as key.- Returns:
- short
Example :
short value = group.getShort("key");
-
getDate
public Calendar getDate(String key)
GetCalendarvalue for key- Parameters:
key- field_uid as key.- Returns:
Date
Example :
Calendar value = group.getDate("key");
-
getAsset
public Asset getAsset(String key)
Get an asset from the group- Parameters:
key- field_uid as key.- Returns:
- Asset object
Example :
Asset asset = group.getAsset("key");
-
getAssets
public List<Asset> getAssets(String key)
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
public Group getGroup(String key)
Get a group from the group.- Parameters:
key- field_uid as key.
Example :
Group innerGroup = group.getGroup("key");- Returns:
- Group object
-
getGroups
public List<Group> getGroups(String key)
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
public ArrayList<Entry> getAllEntries(String refKey, String refContentType)
Get value for the given reference key.- Parameters:
refKey- key of a reference field.refContentType- class uid.- Returns:
ArrayListofEntryinstances. Also specified contentType value will be set as class uid for allEntryinstance.
Example :
//'blt5d4sample2633b' is a dummy Stack API key //'blt6d0240b5sample254090d' is dummy access token.
Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false); Query csQuery = stack.contentType("contentType_name").query(); csQuery.includeReference("for_bug"); csQuery.find(new QueryResultsCallBack() {<br> @ Override public void onCompletion(ResponseType responseType, QueryResult queryResult, Error error) {<br> if(error == null){ List<Entry> list = builtqueryresult.getResultObjects(); for (int i = 0; i < list.queueSize(); i++) { Entry entry = list.get(i); Group group = entry.getGroup("fieldUid"); Entry taskEntry = entry.getAllEntries("for_task", "task"); } } } });<br>
-
-