com.google.gwt.json.client.JSONBoolean Java Examples

The following examples show how to use com.google.gwt.json.client.JSONBoolean. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UploadFile.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private void uploadFile() {
    JSONObject post = new JSONObject();
    String mime = form.getValueAsString(FIELD_MIMETYPE);
    if (mime != null && !mime.trim().isEmpty()) {
        post.put(FIELD_MIMETYPE, new JSONString(mime));
    }
    post.put(FIELD_PID, new JSONString(dobj.getPid()));
    String batchId = dobj.getBatchId();
    if (batchId != null) {
        post.put(FIELD_BATCHID, new JSONString(batchId));
    }
    post.put(DigitalObjectResourceApi.DISSEMINATION_ERROR, JSONBoolean.getInstance(true));
    uploader.setPostParams(post);
    uploader.startUpload();
    showUploading(true);
}
 
Example #2
Source File: GadgetMetadata.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to extract a boolean value from given JSON object.
 *
 * @param json JSON object to extract the value from.
 * @param key key of the value to extract.
 * @return the Boolean object extracted from JSON (can be null if the value
 *         does not exist or is invalid.
 */
private static Boolean getJsonBooleanValue(JSONObject json, String key) {
  JSONValue value = json.get(key);
  JSONBoolean bool = (value == null) ? null : value.isBoolean();
  if (bool != null) {
    return bool.booleanValue();
  } else {
    return null;
  }
}
 
Example #3
Source File: GadgetMetadata.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to extract a boolean value from given JSON object.
 *
 * @param json JSON object to extract the value from.
 * @param key key of the value to extract.
 * @return the Boolean object extracted from JSON (can be null if the value
 *         does not exist or is invalid.
 */
private static Boolean getJsonBooleanValue(JSONObject json, String key) {
  JSONValue value = json.get(key);
  JSONBoolean bool = (value == null) ? null : value.isBoolean();
  if (bool != null) {
    return bool.booleanValue();
  } else {
    return null;
  }
}