A map for storing reported data.
A string constant whose value is event. The data whose key is event in DataBundle is reported through OnPushListener.
This API is used to obtain the object corresponding to a key in DataBundle. If the key is not found, null is returned.
- DataBundle mDataBundle = new DataBundle(new WeOnPushListener());
- Object object = mDataBundle.get("event");
Parameter | Type | Description |
key | String | Key corresponding to data in DataBundle. |
If the key is found, the object corresponding to the key in DataBundle is returned. If the key is not found, null is returned.
This API is used to create a list based on objects.
- Object objArray = {"a","b","java","spring","hadoop","lucene"};
- List<Object> objList = DataBundle.toList(objArray);
Parameter | Type | Description |
objects | Object... | The generated list contains elements in objects. |
A list containing all elements in objects is returned.
This API is used to create a map based on objects.
- Object objArray = {"a","b","java","spring","hadoop","lucene"};
- Map<Object> objList = DataBundle.toMap(objArray);
Parameter | Type | Description |
objects | Object... | The objects array must be in key-value format. |
A map constructed with objects in key-value format is returned.
This API is used to combine update into DataBundle.
- Map objupdate = new HashMap();
- objupdate.put("1", "one");
- objupdate.put("2", "two");
- DataBundle dataBundle = new DataBundle(new WeOnPushListener());
- dataBundle.put(objupdate);
Parameter | Type | Description |
update | Map<String, Object> | The objects array must be in key-value format. |
None.
This API is used to combine key-value data into DataBundle.
- DataBundle dataBundle = new DataBundle(new WeOnPushListener());
- dataBundle.put("1", "one");
Parameter | Type | Description |
key | String | N/A |
value | Object | N/A |
None.
This API is used to combine event and update into DataBundle.
- Map objupdate = new HashMap();
- objupdate.put("1", "one");
- objupdate.put("2", "two");
- DataBundle dataBundle = new DataBundle(new WeOnPushListener());
- dataBundle.putEvent("event", objupdate);
Parameter | Type | Description |
event | String | N/A. |
update | Map<String, Object> | N/A. |
None.
This API is used to return a human-readable string describing DataBundle.
- Map objupdate = new HashMap();
- objupdate.put("1", "one");
- objupdate.put("2", "two");
- DataBundle dataBundle = new DataBundle(new WeOnPushListener());
- dataBundle.pushEvent("event", objupdate);
- dataBundle.toString();
None.
A human-readable string describing DataBundle is returned.