/** * 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("UpdateItemRequest").add("TableName", tableName()).add("Key", key()) .add("AttributeUpdates", attributeUpdates()).add("Expected", expected()) .add("ConditionalOperator", conditionalOperatorAsString()).add("ReturnValues", returnValuesAsString()) .add("ReturnConsumedCapacity", returnConsumedCapacityAsString()) .add("ReturnItemCollectionMetrics", returnItemCollectionMetricsAsString()) .add("UpdateExpression", updateExpression()).add("ConditionExpression", conditionExpression()) .add("ExpressionAttributeNames", expressionAttributeNames()) .add("ExpressionAttributeValues", expressionAttributeValues()).build(); }
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 "AttributeUpdates": return Optional.ofNullable(clazz.cast(attributeUpdates())); case "Expected": return Optional.ofNullable(clazz.cast(expected())); case "ConditionalOperator": return Optional.ofNullable(clazz.cast(conditionalOperatorAsString())); 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 "UpdateExpression": return Optional.ofNullable(clazz.cast(updateExpression())); 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 int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(tableName()); hashCode = 31 * hashCode + Objects.hashCode(key()); hashCode = 31 * hashCode + Objects.hashCode(attributeUpdates()); hashCode = 31 * hashCode + Objects.hashCode(expected()); hashCode = 31 * hashCode + Objects.hashCode(conditionalOperatorAsString()); hashCode = 31 * hashCode + Objects.hashCode(returnValuesAsString()); hashCode = 31 * hashCode + Objects.hashCode(returnConsumedCapacityAsString()); hashCode = 31 * hashCode + Objects.hashCode(returnItemCollectionMetricsAsString()); hashCode = 31 * hashCode + Objects.hashCode(updateExpression()); hashCode = 31 * hashCode + Objects.hashCode(conditionExpression()); hashCode = 31 * hashCode + Objects.hashCode(expressionAttributeNames()); hashCode = 31 * hashCode + Objects.hashCode(expressionAttributeValues()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof UpdateItemRequest)) { return false; } UpdateItemRequest other = (UpdateItemRequest) obj; return Objects.equals(tableName(), other.tableName()) && Objects.equals(key(), other.key()) && Objects.equals(attributeUpdates(), other.attributeUpdates()) && Objects.equals(expected(), other.expected()) && Objects.equals(conditionalOperatorAsString(), other.conditionalOperatorAsString()) && Objects.equals(returnValuesAsString(), other.returnValuesAsString()) && Objects.equals(returnConsumedCapacityAsString(), other.returnConsumedCapacityAsString()) && Objects.equals(returnItemCollectionMetricsAsString(), other.returnItemCollectionMetricsAsString()) && Objects.equals(updateExpression(), other.updateExpression()) && Objects.equals(conditionExpression(), other.conditionExpression()) && Objects.equals(expressionAttributeNames(), other.expressionAttributeNames()) && Objects.equals(expressionAttributeValues(), other.expressionAttributeValues()); }