attrValues.put(":"+partition_key_name, AttributeValue.builder().s(partition_key_val).build()); QueryRequest queryReq = QueryRequest.builder() .tableName(table_name) .keyConditionExpression(partition_alias + " = :" + partition_key_name)
/** * 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(); }
@Override public QueryRequest build() { return new QueryRequest(this); }
@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()); }
return query(QueryRequest.builder().applyMutation(queryRequest).build());
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "TableName": return Optional.ofNullable(clazz.cast(tableName())); case "IndexName": return Optional.ofNullable(clazz.cast(indexName())); case "Select": return Optional.ofNullable(clazz.cast(selectAsString())); case "AttributesToGet": return Optional.ofNullable(clazz.cast(attributesToGet())); case "Limit": return Optional.ofNullable(clazz.cast(limit())); case "ConsistentRead": return Optional.ofNullable(clazz.cast(consistentRead())); case "KeyConditions": return Optional.ofNullable(clazz.cast(keyConditions())); case "QueryFilter": return Optional.ofNullable(clazz.cast(queryFilter())); case "ConditionalOperator": return Optional.ofNullable(clazz.cast(conditionalOperatorAsString())); case "ScanIndexForward": return Optional.ofNullable(clazz.cast(scanIndexForward())); case "ExclusiveStartKey": return Optional.ofNullable(clazz.cast(exclusiveStartKey())); case "ReturnConsumedCapacity": return Optional.ofNullable(clazz.cast(returnConsumedCapacityAsString())); case "ProjectionExpression": return Optional.ofNullable(clazz.cast(projectionExpression())); case "FilterExpression": return Optional.ofNullable(clazz.cast(filterExpression()));
ResourceNotFoundException, RequestLimitExceededException, InternalServerErrorException, AwsServiceException, SdkClientException, DynamoDbException { return query(QueryRequest.builder().applyMutation(queryRequest).build());
return queryPaginator(QueryRequest.builder().applyMutation(queryRequest).build());
throws ProvisionedThroughputExceededException, ResourceNotFoundException, RequestLimitExceededException, InternalServerErrorException, AwsServiceException, SdkClientException, DynamoDbException { return queryPaginator(QueryRequest.builder().applyMutation(queryRequest).build());