/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("PutObjectResponse").add("Expiration", expiration()).add("ETag", eTag()) .add("ServerSideEncryption", serverSideEncryptionAsString()).add("VersionId", versionId()) .add("SSECustomerAlgorithm", sseCustomerAlgorithm()).add("SSECustomerKeyMD5", sseCustomerKeyMD5()) .add("SSEKMSKeyId", ssekmsKeyId() == null ? null : "*** Sensitive Data Redacted ***") .add("RequestCharged", requestChargedAsString()).build(); }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(expiration()); hashCode = 31 * hashCode + Objects.hashCode(eTag()); hashCode = 31 * hashCode + Objects.hashCode(serverSideEncryptionAsString()); hashCode = 31 * hashCode + Objects.hashCode(versionId()); hashCode = 31 * hashCode + Objects.hashCode(sseCustomerAlgorithm()); hashCode = 31 * hashCode + Objects.hashCode(sseCustomerKeyMD5()); hashCode = 31 * hashCode + Objects.hashCode(ssekmsKeyId()); hashCode = 31 * hashCode + Objects.hashCode(requestChargedAsString()); return hashCode; }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "Expiration": return Optional.ofNullable(clazz.cast(expiration())); case "ETag": return Optional.ofNullable(clazz.cast(eTag())); case "ServerSideEncryption": return Optional.ofNullable(clazz.cast(serverSideEncryptionAsString())); case "VersionId": return Optional.ofNullable(clazz.cast(versionId())); case "SSECustomerAlgorithm": return Optional.ofNullable(clazz.cast(sseCustomerAlgorithm())); case "SSECustomerKeyMD5": return Optional.ofNullable(clazz.cast(sseCustomerKeyMD5())); case "SSEKMSKeyId": return Optional.ofNullable(clazz.cast(ssekmsKeyId())); case "RequestCharged": return Optional.ofNullable(clazz.cast(requestChargedAsString())); default: return Optional.empty(); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PutObjectResponse)) { return false; } PutObjectResponse other = (PutObjectResponse) obj; return Objects.equals(expiration(), other.expiration()) && Objects.equals(eTag(), other.eTag()) && Objects.equals(serverSideEncryptionAsString(), other.serverSideEncryptionAsString()) && Objects.equals(versionId(), other.versionId()) && Objects.equals(sseCustomerAlgorithm(), other.sseCustomerAlgorithm()) && Objects.equals(sseCustomerKeyMD5(), other.sseCustomerKeyMD5()) && Objects.equals(ssekmsKeyId(), other.ssekmsKeyId()) && Objects.equals(requestChargedAsString(), other.requestChargedAsString()); }