use of com.eclipsesource.json.JsonObject in project box-android-sdk by box.
the class BoxRequestUpdateSharedItem method setUnsharedAt.
/**
* Sets the date that this shared link will be deactivated. If this is set to null it will remove the
* unshared at date that is set on this item.
* Note: the date will be rounded to the day as the API does not support hours, minutes, or seconds
*
* @param unsharedAt the date that this shared link will be deactivated.
* @return the updated request
* @throws ParseException thrown if date provided cannot be properly parsed.
*/
public R setUnsharedAt(Date unsharedAt) throws ParseException {
JsonObject jsonObject = getSharedLinkJsonObject();
if (unsharedAt == null) {
jsonObject.add(BoxSharedLink.FIELD_UNSHARED_AT, JsonValue.NULL);
} else {
jsonObject.add(BoxSharedLink.FIELD_UNSHARED_AT, BoxDateFormat.format(BoxDateFormat.convertToDay(unsharedAt)));
}
BoxSharedLink sharedLink = new BoxSharedLink(jsonObject);
mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
return (R) this;
}
use of com.eclipsesource.json.JsonObject in project box-android-sdk by box.
the class BoxFolder method createFromIdAndName.
/**
* A convenience method to create an empty folder with just the id and type fields set. This allows
* the ability to interact with the content sdk in a more descriptive and type safe manner
*
* @param folderId the id of folder to create
* @param name the name of the folder to create
* @return an empty BoxFolder object that only contains id and type information
*/
public static BoxFolder createFromIdAndName(String folderId, String name) {
JsonObject object = new JsonObject();
object.add(BoxItem.FIELD_ID, folderId);
object.add(BoxItem.FIELD_TYPE, BoxFolder.TYPE);
if (!TextUtils.isEmpty(name)) {
object.add(BoxItem.FIELD_NAME, name);
}
return new BoxFolder(object);
}
use of com.eclipsesource.json.JsonObject in project box-android-sdk by box.
the class BoxGroup method createFromId.
/**
* A convenience method to create an empty group with just the id and type fields set. This allows
* the ability to interact with the content sdk in a more descriptive and type safe manner
*
* @param groupId the id of group to create
* @return an empty BoxGroup object that only contains id and type information
*/
public static BoxGroup createFromId(String groupId) {
JsonObject object = new JsonObject();
object.add(BoxCollaborator.FIELD_ID, groupId);
object.add(BoxCollaborator.FIELD_TYPE, BoxUser.TYPE);
return new BoxGroup(object);
}
use of com.eclipsesource.json.JsonObject in project bytecode-viewer by Konloch.
the class DecompilerSettings method saveTo.
public void saveTo(JsonObject rootSettings) {
if (rootSettings.get("decompilers") == null) {
rootSettings.add("decompilers", new JsonObject());
}
JsonObject decompilerSection = rootSettings.get("decompilers").asObject();
if (decompilerSection.get(decompiler.getName()) == null) {
decompilerSection.add(decompiler.getName(), new JsonObject());
}
JsonObject thisDecompiler = decompilerSection.get(decompiler.getName()).asObject();
for (Map.Entry<Setting, JCheckBoxMenuItem> entry : menuItems.entrySet()) {
thisDecompiler.add(entry.getKey().getParam(), entry.getValue().isSelected());
}
}
use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.
the class SlowOperationDetector_JsonTest method testJSON_multipleEntryProcessorClasses.
@Test
public void testJSON_multipleEntryProcessorClasses() throws InterruptedException {
for (int i = 0; i < 2; i++) {
map.executeOnEntries(getSlowEntryProcessor(3));
}
SlowEntryProcessorChild entryProcessorChild = new SlowEntryProcessorChild(3);
map.executeOnEntries(entryProcessorChild);
map.executeOnEntries(getSlowEntryProcessor(4));
awaitSlowEntryProcessors();
entryProcessorChild.await();
logger.finest(getOperationStats(instance).toString());
JsonArray slowOperationLogsJsonArray = getSlowOperationLogsJsonArray(instance);
JsonObject firstLogJsonObject = slowOperationLogsJsonArray.get(0).asObject();
JsonObject secondLogJsonObject = slowOperationLogsJsonArray.get(1).asObject();
assertJSONContainsClassNameJustOnce(firstLogJsonObject, secondLogJsonObject, "SlowEntryProcessor");
assertJSONContainsClassNameJustOnce(firstLogJsonObject, secondLogJsonObject, "SlowEntryProcessorChild");
int firstSize = firstLogJsonObject.get("invocations").asArray().size();
int secondSize = secondLogJsonObject.get("invocations").asArray().size();
assertTrue(format("Expected to find 1 and 3 invocations in logs, but was %d and %d", firstSize, secondSize), (firstSize == 1 ^ secondSize == 1) && (firstSize == 3 ^ secondSize == 3));
}
Aggregations