/** * 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("PutItemRequest").add("TableName", tableName()).add("Item", item()).add("Expected", expected()) .add("ReturnValues", returnValuesAsString()).add("ReturnConsumedCapacity", returnConsumedCapacityAsString()) .add("ReturnItemCollectionMetrics", returnItemCollectionMetricsAsString()) .add("ConditionalOperator", conditionalOperatorAsString()).add("ConditionExpression", conditionExpression()) .add("ExpressionAttributeNames", expressionAttributeNames()) .add("ExpressionAttributeValues", expressionAttributeValues()).build(); }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(tableName()); hashCode = 31 * hashCode + Objects.hashCode(item()); hashCode = 31 * hashCode + Objects.hashCode(expected()); hashCode = 31 * hashCode + Objects.hashCode(returnValuesAsString()); hashCode = 31 * hashCode + Objects.hashCode(returnConsumedCapacityAsString()); hashCode = 31 * hashCode + Objects.hashCode(returnItemCollectionMetricsAsString()); hashCode = 31 * hashCode + Objects.hashCode(conditionalOperatorAsString()); hashCode = 31 * hashCode + Objects.hashCode(conditionExpression()); hashCode = 31 * hashCode + Objects.hashCode(expressionAttributeNames()); hashCode = 31 * hashCode + Objects.hashCode(expressionAttributeValues()); return hashCode; }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "TableName": return Optional.ofNullable(clazz.cast(tableName())); case "Item": return Optional.ofNullable(clazz.cast(item())); case "Expected": return Optional.ofNullable(clazz.cast(expected())); case "ReturnValues": return Optional.ofNullable(clazz.cast(returnValuesAsString())); case "ReturnConsumedCapacity": return Optional.ofNullable(clazz.cast(returnConsumedCapacityAsString())); case "ReturnItemCollectionMetrics": return Optional.ofNullable(clazz.cast(returnItemCollectionMetricsAsString())); case "ConditionalOperator": return Optional.ofNullable(clazz.cast(conditionalOperatorAsString())); case "ConditionExpression": return Optional.ofNullable(clazz.cast(conditionExpression())); case "ExpressionAttributeNames": return Optional.ofNullable(clazz.cast(expressionAttributeNames())); case "ExpressionAttributeValues": return Optional.ofNullable(clazz.cast(expressionAttributeValues())); default: return Optional.empty(); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PutItemRequest)) { return false; } PutItemRequest other = (PutItemRequest) obj; return Objects.equals(tableName(), other.tableName()) && Objects.equals(item(), other.item()) && Objects.equals(expected(), other.expected()) && Objects.equals(returnValuesAsString(), other.returnValuesAsString()) && Objects.equals(returnConsumedCapacityAsString(), other.returnConsumedCapacityAsString()) && Objects.equals(returnItemCollectionMetricsAsString(), other.returnItemCollectionMetricsAsString()) && Objects.equals(conditionalOperatorAsString(), other.conditionalOperatorAsString()) && Objects.equals(conditionExpression(), other.conditionExpression()) && Objects.equals(expressionAttributeNames(), other.expressionAttributeNames()) && Objects.equals(expressionAttributeValues(), other.expressionAttributeValues()); }