Java Code Examples for com.eclipsesource.json.JsonValue#toString()
The following examples show how to use
com.eclipsesource.json.JsonValue#toString() .
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: EmailAlias.java From box-java-sdk with Apache License 2.0 | 6 votes |
@Override void parseJSONMember(JsonObject.Member member) { JsonValue value = member.getValue(); String memberName = member.getName(); try { if (memberName.equals("id")) { this.id = value.asString(); } else if (memberName.equals("is_confirmed")) { this.isConfirmed = value.asBoolean(); } else if (memberName.equals("email")) { this.email = value.asString(); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 2
Source File: BoxGroup.java From box-java-sdk with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override protected void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); try { if (memberName.equals("description")) { this.description = value.asString(); } else if (memberName.equals("external_sync_identifier")) { this.externalSyncIdentifier = value.asString(); } else if (memberName.equals("invitability_level")) { this.invitabilityLevel = value.asString(); } else if (memberName.equals("member_viewability_level")) { this.memberViewabilityLevel = value.asString(); } else if (memberName.equals("provenance")) { this.provenance = value.asString(); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 3
Source File: BoxLock.java From box-java-sdk with Apache License 2.0 | 5 votes |
@Override protected void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); try { if (memberName.equals("type")) { this.type = value.asString(); } else if (memberName.equals("expires_at")) { this.expiresAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("is_download_prevented")) { this.isDownloadPrevented = value.asBoolean(); } else if (memberName.equals("created_by")) { JsonObject userJSON = value.asObject(); if (this.createdBy == null) { String userID = userJSON.get("id").asString(); BoxUser user = new BoxUser(this.api, userID); this.createdBy = user.new Info(userJSON); } else { this.createdBy.update(userJSON); } } else if (memberName.equals("created_at")) { this.createdAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("id")) { this.id = value.toString(); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 4
Source File: BoxTask.java From box-java-sdk with Apache License 2.0 | 5 votes |
@Override void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); try { if (memberName.equals("item")) { JsonObject itemJSON = value.asObject(); String itemID = itemJSON.get("id").asString(); BoxFile file = new BoxFile(getAPI(), itemID); this.item = file.new Info(itemJSON); } else if (memberName.equals("due_at")) { this.dueAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("action")) { this.action = value.asString(); } else if (memberName.equals("completion_rule")) { this.completionRule = value.asString(); } else if (memberName.equals("message")) { this.message = value.asString(); } else if (memberName.equals("task_assignment_collection")) { this.taskAssignments = this.parseTaskAssignmentCollection(value.asObject()); } else if (memberName.equals("is_completed")) { this.completed = value.asBoolean(); } else if (memberName.equals("created_by")) { JsonObject userJSON = value.asObject(); String userID = userJSON.get("id").asString(); BoxUser user = new BoxUser(getAPI(), userID); this.createdBy = user.new Info(userJSON); } else if (memberName.equals("created_at")) { this.createdAt = BoxDateFormat.parse(value.asString()); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 5
Source File: BoxStoragePolicy.java From box-java-sdk with Apache License 2.0 | 5 votes |
@Override void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); try { if (memberName.equals("name")) { this.storagePolicyName = value.asString(); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 6
Source File: BoxCollaborationWhitelist.java From box-java-sdk with Apache License 2.0 | 5 votes |
@Override protected void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); try { if (memberName.equals("domain")) { this.domain = value.asString(); } else if (memberName.equals("type")) { this.type = value.asString(); } else if (memberName.equals("direction")) { this.direction = WhitelistDirection.fromDirection(value.asString()); } else if (memberName.equals("enterprise")) { JsonObject jsonObject = value.asObject(); this.enterprise = new BoxEnterprise(jsonObject); } else if (memberName.equals("created_at")) { this.createdAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("modified_at")) { this.modifiedAt = BoxDateFormat.parse(value.asString()); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 7
Source File: BoxUploadEmail.java From box-java-sdk with Apache License 2.0 | 5 votes |
@Override void parseJSONMember(JsonObject.Member member) { JsonValue value = member.getValue(); String memberName = member.getName(); try { if (memberName.equals("access")) { this.access = Access.fromJSONValue(value.asString()); } else if (memberName.equals("email")) { this.email = value.asString(); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 8
Source File: BoxMetadataCascadePolicy.java From box-java-sdk with Apache License 2.0 | 5 votes |
@Override protected void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); try { if (memberName.equals("owner_enterprise")) { JsonObject jsonObject = value.asObject(); this.ownerEnterprise = new BoxEnterprise(jsonObject); } else if (memberName.equals("parent")) { JsonObject parentJSON = value.asObject(); if (this.parent == null) { String parentID = parentJSON.get("id").asString(); BoxFolder folder = new BoxFolder(getAPI(), parentID); this.parent = folder.new Info(parentJSON); } else { this.parent.update(parentJSON); } } else if (memberName.equals("scope")) { this.scope = value.asString(); } else if (memberName.equals("templateKey")) { this.templateKey = value.asString(); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 9
Source File: BoxSharedLink.java From box-java-sdk with Apache License 2.0 | 5 votes |
@Override void parseJSONMember(JsonObject.Member member) { JsonValue value = member.getValue(); String memberName = member.getName(); try { if (memberName.equals("url")) { this.url = value.asString(); } else if (memberName.equals("download_url")) { this.downloadUrl = value.asString(); } else if (memberName.equals("vanity_url")) { this.vanityUrl = value.asString(); } else if (memberName.equals("is_password_enabled")) { this.isPasswordEnabled = value.asBoolean(); } else if (memberName.equals("unshared_at")) { this.unsharedAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("download_count")) { this.downloadCount = Double.valueOf(value.toString()).longValue(); } else if (memberName.equals("preview_count")) { this.previewCount = Double.valueOf(value.toString()).longValue(); } else if (memberName.equals("access")) { this.access = this.parseAccessValue(value); } else if (memberName.equals("effective_access")) { this.effectiveAccess = this.parseAccessValue(value); } else if (memberName.equals("permissions")) { if (this.permissions == null) { this.setPermissions(new Permissions(value.asObject())); } else { this.permissions.update(value.asObject()); } } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 10
Source File: RecipeJson.java From Cubes with MIT License | 5 votes |
public static ItemStack parseStack(JsonValue json) { if (json.isString()) { return new ItemStack(getItem(json.asString())); } else if (json.isObject()) { JsonObject obj = json.asObject(); JsonValue id = obj.get("id"); if (id == null) throw new JsonException("No id"); return new ItemStack(getItem(id.asString()), obj.getInt("count", 1), obj.getInt("meta", 0)); } else if (json.isNull()) { return null; } throw new JsonException("Invalid type " + json.toString()); }
Example 11
Source File: ZCashClientCaller.java From zencash-swing-wallet-ui with MIT License | 5 votes |
private JsonObject executeCommandAndGetJsonObject(String command1, String command2) throws WalletCallException, IOException, InterruptedException { JsonValue response = this.executeCommandAndGetJsonValue(command1, command2); if (response.isObject()) { return response.asObject(); } else { throw new WalletCallException("Unexpected non-object response from wallet: " + response.toString()); } }
Example 12
Source File: BoxCollaborationWhitelistExemptTarget.java From box-java-sdk with Apache License 2.0 | 5 votes |
@Override protected void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); try { if (memberName.equals("user")) { JsonObject userJSON = value.asObject(); String userID = userJSON.get("id").asString(); BoxUser user = new BoxUser(getAPI(), userID); this.user = user.new Info(userJSON); } else if (memberName.equals("type")) { this.type = value.asString(); } else if (memberName.equals("enterprise")) { JsonObject jsonObject = value.asObject(); this.enterprise = new BoxEnterprise(jsonObject); } else if (memberName.equals("created_at")) { this.createdAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("modified_at")) { this.modifiedAt = BoxDateFormat.parse(value.asString()); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 13
Source File: BoxWatermark.java From box-java-sdk with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); if (memberName.equals(WATERMARK_JSON_KEY)) { try { this.createdAt = BoxDateFormat.parse(value.asObject().get(CREATED_AT_JSON_KEY).asString()); this.modifiedAt = BoxDateFormat.parse(value.asObject().get(MODIFIED_AT_JSON_KEY).asString()); } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } } }
Example 14
Source File: BoxTermsOfService.java From box-java-sdk with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); try { if (memberName.equals("status")) { this.status = TermsOfServiceStatus.fromStatus(value.asString()); } else if (memberName.equals("enterprise")) { JsonObject jsonObject = value.asObject(); this.enterprise = new BoxEnterprise(jsonObject); } else if (memberName.equals("type")) { this.type = value.asString(); } else if (memberName.equals("tos_type")) { this.tosType = TermsOfServiceType.fromTosType(value.asString()); } else if (memberName.equals("text")) { this.text = value.asString(); } else if (memberName.equals("created_at")) { this.createdAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("modified_at")) { this.modifiedAt = BoxDateFormat.parse(value.asString()); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 15
Source File: ZCashClientCaller.java From zencash-swing-wallet-ui with MIT License | 5 votes |
private JsonArray executeCommandAndGetJsonArray(String command1, String command2, String command3) throws WalletCallException, IOException, InterruptedException { JsonValue response = this.executeCommandAndGetJsonValue(command1, command2, command3); if (response.isArray()) { return response.asArray(); } else { throw new WalletCallException("Unexpected non-array response from wallet: " + response.toString()); } }
Example 16
Source File: BoxLegalHoldPolicy.java From box-java-sdk with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); try { if (memberName.equals("policy_name")) { this.policyName = value.asString(); } else if (memberName.equals("description")) { this.description = value.asString(); } else if (memberName.equals("status")) { this.status = value.asString(); } else if (memberName.equals("release_notes")) { this.releaseNotes = value.asString(); } else if (memberName.equals("assignment_counts")) { JsonObject countsJSON = value.asObject(); this.assignmentCountUser = countsJSON.get("user").asInt(); this.assignmentCountFolder = countsJSON.get("folder").asInt(); this.assignmentCountFile = countsJSON.get("file").asInt(); this.assignmentCountFileVersion = countsJSON.get("file_version").asInt(); } else if (memberName.equals("created_by")) { JsonObject userJSON = value.asObject(); if (this.createdBy == null) { String userID = userJSON.get("id").asString(); BoxUser user = new BoxUser(getAPI(), userID); this.createdBy = user.new Info(userJSON); } else { this.createdBy.update(userJSON); } } else if (memberName.equals("created_at")) { this.createdAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("modified_at")) { this.modifiedAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("deleted_at")) { this.deletedAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("filter_started_at")) { this.filterStartedAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("filter_ended_at")) { this.filterEndedAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("is_ongoing")) { this.isOngoing = value.asBoolean(); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 17
Source File: Utils.java From Skype4J with Apache License 2.0 | 4 votes |
public static String coerceToString(JsonValue value) { return value.isString() ? value.asString() : value.toString(); }
Example 18
Source File: ModelAndView.java From r2cloud with Apache License 2.0 | 4 votes |
public void setData(JsonValue data) { this.data = data.toString(); }
Example 19
Source File: BoxRetentionPolicyAssignment.java From box-java-sdk with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); String memberName = member.getName(); JsonValue value = member.getValue(); try { if (memberName.equals("retention_policy")) { JsonObject policyJSON = value.asObject(); if (this.retentionPolicy == null) { String policyID = policyJSON.get("id").asString(); BoxRetentionPolicy policy = new BoxRetentionPolicy(getAPI(), policyID); this.retentionPolicy = policy.new Info(policyJSON); } else { this.retentionPolicy.update(policyJSON); } } else if (memberName.equals("assigned_to")) { JsonObject assignmentJSON = value.asObject(); this.assignedToType = assignmentJSON.get("type").asString(); if (this.assignedToType.equals(TYPE_ENTERPRISE)) { this.assignedToID = null; } else { this.assignedToID = assignmentJSON.get("id").asString(); } } else if (memberName.equals("assigned_by")) { JsonObject userJSON = value.asObject(); if (this.assignedBy == null) { String userID = userJSON.get("id").asString(); BoxUser user = new BoxUser(getAPI(), userID); this.assignedBy = user.new Info(userJSON); } else { this.assignedBy.update(userJSON); } } else if (memberName.equals("assigned_at")) { this.assignedAt = BoxDateFormat.parse(value.asString()); } else if (memberName.equals("filter_fields")) { JsonArray jsonFilters = value.asArray(); List<MetadataFieldFilter> filterFields = new ArrayList<MetadataFieldFilter>(); for (int i = 0; i < jsonFilters.size(); i++) { filterFields.add(new MetadataFieldFilter(jsonFilters.get(i).asObject())); } this.filterFields = filterFields; } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }
Example 20
Source File: BoxUser.java From box-java-sdk with Apache License 2.0 | 4 votes |
@Override protected void parseJSONMember(JsonObject.Member member) { super.parseJSONMember(member); JsonValue value = member.getValue(); String memberName = member.getName(); try { if (memberName.equals("login")) { this.login = value.asString(); } else if (memberName.equals("role")) { this.role = Role.fromJSONValue(value.asString()); } else if (memberName.equals("language")) { this.language = value.asString(); } else if (memberName.equals("timezone")) { this.timezone = value.asString(); } else if (memberName.equals("space_amount")) { this.spaceAmount = Double.valueOf(value.toString()).longValue(); } else if (memberName.equals("space_used")) { this.spaceUsed = Double.valueOf(value.toString()).longValue(); } else if (memberName.equals("max_upload_size")) { this.maxUploadSize = Double.valueOf(value.toString()).longValue(); } else if (memberName.equals("status")) { this.status = Status.fromJSONValue(value.asString()); } else if (memberName.equals("job_title")) { this.jobTitle = value.asString(); } else if (memberName.equals("phone")) { this.phone = value.asString(); } else if (memberName.equals("address")) { this.address = value.asString(); } else if (memberName.equals("avatar_url")) { this.avatarURL = value.asString(); } else if (memberName.equals("can_see_managed_users")) { this.canSeeManagedUsers = value.asBoolean(); } else if (memberName.equals("is_sync_enabled")) { this.isSyncEnabled = value.asBoolean(); } else if (memberName.equals("is_external_collab_restricted")) { this.isExternalCollabRestricted = value.asBoolean(); } else if (memberName.equals("is_exempt_from_device_limits")) { this.isExemptFromDeviceLimits = value.asBoolean(); } else if (memberName.equals("is_exempt_from_login_verification")) { this.isExemptFromLoginVerification = value.asBoolean(); } else if (memberName.equals("is_password_reset_required")) { this.isPasswordResetRequired = value.asBoolean(); } else if (memberName.equals("is_platform_access_only")) { this.isPlatformAccessOnly = value.asBoolean(); } else if (memberName.equals("external_app_user_id")) { this.externalAppUserId = value.asString(); } else if (memberName.equals("enterprise")) { JsonObject jsonObject = value.asObject(); if (this.enterprise == null) { this.enterprise = new BoxEnterprise(jsonObject); } else { this.enterprise.update(jsonObject); } } else if (memberName.equals("my_tags")) { this.myTags = this.parseMyTags(value.asArray()); } else if (memberName.equals("hostname")) { this.hostname = value.asString(); } else if (memberName.equals("tracking_codes")) { this.trackingCodes = this.parseTrackingCodes(value.asArray()); } } catch (Exception e) { throw new BoxDeserializationException(memberName, value.toString(), e); } }