/** * 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("ListObjectsV2Response").add("IsTruncated", isTruncated()).add("Contents", contents()) .add("Name", name()).add("Prefix", prefix()).add("Delimiter", delimiter()).add("MaxKeys", maxKeys()) .add("CommonPrefixes", commonPrefixes()).add("EncodingType", encodingTypeAsString()).add("KeyCount", keyCount()) .add("ContinuationToken", continuationToken()).add("NextContinuationToken", nextContinuationToken()) .add("StartAfter", startAfter()).build(); }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "IsTruncated": return Optional.ofNullable(clazz.cast(isTruncated())); case "Contents": return Optional.ofNullable(clazz.cast(contents())); case "Name": return Optional.ofNullable(clazz.cast(name())); case "Prefix": return Optional.ofNullable(clazz.cast(prefix())); case "Delimiter": return Optional.ofNullable(clazz.cast(delimiter())); case "MaxKeys": return Optional.ofNullable(clazz.cast(maxKeys())); case "CommonPrefixes": return Optional.ofNullable(clazz.cast(commonPrefixes())); case "EncodingType": return Optional.ofNullable(clazz.cast(encodingTypeAsString())); case "KeyCount": return Optional.ofNullable(clazz.cast(keyCount())); case "ContinuationToken": return Optional.ofNullable(clazz.cast(continuationToken())); case "NextContinuationToken": return Optional.ofNullable(clazz.cast(nextContinuationToken())); case "StartAfter": return Optional.ofNullable(clazz.cast(startAfter())); default: return Optional.empty(); } }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(isTruncated()); hashCode = 31 * hashCode + Objects.hashCode(contents()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(prefix()); hashCode = 31 * hashCode + Objects.hashCode(delimiter()); hashCode = 31 * hashCode + Objects.hashCode(maxKeys()); hashCode = 31 * hashCode + Objects.hashCode(commonPrefixes()); hashCode = 31 * hashCode + Objects.hashCode(encodingTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(keyCount()); hashCode = 31 * hashCode + Objects.hashCode(continuationToken()); hashCode = 31 * hashCode + Objects.hashCode(nextContinuationToken()); hashCode = 31 * hashCode + Objects.hashCode(startAfter()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ListObjectsV2Response)) { return false; } ListObjectsV2Response other = (ListObjectsV2Response) obj; return Objects.equals(isTruncated(), other.isTruncated()) && Objects.equals(contents(), other.contents()) && Objects.equals(name(), other.name()) && Objects.equals(prefix(), other.prefix()) && Objects.equals(delimiter(), other.delimiter()) && Objects.equals(maxKeys(), other.maxKeys()) && Objects.equals(commonPrefixes(), other.commonPrefixes()) && Objects.equals(encodingTypeAsString(), other.encodingTypeAsString()) && Objects.equals(keyCount(), other.keyCount()) && Objects.equals(continuationToken(), other.continuationToken()) && Objects.equals(nextContinuationToken(), other.nextContinuationToken()) && Objects.equals(startAfter(), other.startAfter()); }