/** * 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("QueryRequest").add("TableName", tableName()).add("IndexName", indexName()) .add("Select", selectAsString()).add("AttributesToGet", attributesToGet()).add("Limit", limit()) .add("ConsistentRead", consistentRead()).add("KeyConditions", keyConditions()).add("QueryFilter", queryFilter()) .add("ConditionalOperator", conditionalOperatorAsString()).add("ScanIndexForward", scanIndexForward()) .add("ExclusiveStartKey", exclusiveStartKey()).add("ReturnConsumedCapacity", returnConsumedCapacityAsString()) .add("ProjectionExpression", projectionExpression()).add("FilterExpression", filterExpression()) .add("KeyConditionExpression", keyConditionExpression()) .add("ExpressionAttributeNames", expressionAttributeNames()) .add("ExpressionAttributeValues", expressionAttributeValues()).build(); }
return Optional.ofNullable(clazz.cast(limit())); case "ConsistentRead": return Optional.ofNullable(clazz.cast(consistentRead())); case "KeyConditions": return Optional.ofNullable(clazz.cast(keyConditions()));
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(tableName()); hashCode = 31 * hashCode + Objects.hashCode(indexName()); hashCode = 31 * hashCode + Objects.hashCode(selectAsString()); hashCode = 31 * hashCode + Objects.hashCode(attributesToGet()); hashCode = 31 * hashCode + Objects.hashCode(limit()); hashCode = 31 * hashCode + Objects.hashCode(consistentRead()); hashCode = 31 * hashCode + Objects.hashCode(keyConditions()); hashCode = 31 * hashCode + Objects.hashCode(queryFilter()); hashCode = 31 * hashCode + Objects.hashCode(conditionalOperatorAsString()); hashCode = 31 * hashCode + Objects.hashCode(scanIndexForward()); hashCode = 31 * hashCode + Objects.hashCode(exclusiveStartKey()); hashCode = 31 * hashCode + Objects.hashCode(returnConsumedCapacityAsString()); hashCode = 31 * hashCode + Objects.hashCode(projectionExpression()); hashCode = 31 * hashCode + Objects.hashCode(filterExpression()); hashCode = 31 * hashCode + Objects.hashCode(keyConditionExpression()); 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 QueryRequest)) { return false; } QueryRequest other = (QueryRequest) obj; return Objects.equals(tableName(), other.tableName()) && Objects.equals(indexName(), other.indexName()) && Objects.equals(selectAsString(), other.selectAsString()) && Objects.equals(attributesToGet(), other.attributesToGet()) && Objects.equals(limit(), other.limit()) && Objects.equals(consistentRead(), other.consistentRead()) && Objects.equals(keyConditions(), other.keyConditions()) && Objects.equals(queryFilter(), other.queryFilter()) && Objects.equals(conditionalOperatorAsString(), other.conditionalOperatorAsString()) && Objects.equals(scanIndexForward(), other.scanIndexForward()) && Objects.equals(exclusiveStartKey(), other.exclusiveStartKey()) && Objects.equals(returnConsumedCapacityAsString(), other.returnConsumedCapacityAsString()) && Objects.equals(projectionExpression(), other.projectionExpression()) && Objects.equals(filterExpression(), other.filterExpression()) && Objects.equals(keyConditionExpression(), other.keyConditionExpression()) && Objects.equals(expressionAttributeNames(), other.expressionAttributeNames()) && Objects.equals(expressionAttributeValues(), other.expressionAttributeValues()); }