/** * 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("GetItemRequest").add("TableName", tableName()).add("Key", key()) .add("AttributesToGet", attributesToGet()).add("ConsistentRead", consistentRead()) .add("ReturnConsumedCapacity", returnConsumedCapacityAsString()) .add("ProjectionExpression", projectionExpression()).add("ExpressionAttributeNames", expressionAttributeNames()) .build(); }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(tableName()); hashCode = 31 * hashCode + Objects.hashCode(key()); hashCode = 31 * hashCode + Objects.hashCode(attributesToGet()); hashCode = 31 * hashCode + Objects.hashCode(consistentRead()); hashCode = 31 * hashCode + Objects.hashCode(returnConsumedCapacityAsString()); hashCode = 31 * hashCode + Objects.hashCode(projectionExpression()); hashCode = 31 * hashCode + Objects.hashCode(expressionAttributeNames()); return hashCode; }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "TableName": return Optional.ofNullable(clazz.cast(tableName())); case "Key": return Optional.ofNullable(clazz.cast(key())); case "AttributesToGet": return Optional.ofNullable(clazz.cast(attributesToGet())); case "ConsistentRead": return Optional.ofNullable(clazz.cast(consistentRead())); case "ReturnConsumedCapacity": return Optional.ofNullable(clazz.cast(returnConsumedCapacityAsString())); case "ProjectionExpression": return Optional.ofNullable(clazz.cast(projectionExpression())); case "ExpressionAttributeNames": return Optional.ofNullable(clazz.cast(expressionAttributeNames())); default: return Optional.empty(); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof GetItemRequest)) { return false; } GetItemRequest other = (GetItemRequest) obj; return Objects.equals(tableName(), other.tableName()) && Objects.equals(key(), other.key()) && Objects.equals(attributesToGet(), other.attributesToGet()) && Objects.equals(consistentRead(), other.consistentRead()) && Objects.equals(returnConsumedCapacityAsString(), other.returnConsumedCapacityAsString()) && Objects.equals(projectionExpression(), other.projectionExpression()) && Objects.equals(expressionAttributeNames(), other.expressionAttributeNames()); }