public class SimpleStatement extends Statement
Statement
implementation built directly from a query
string.Constructor and Description |
---|
SimpleStatement(String query)
Creates a new
SimpleStatement with the provided query string. |
Modifier and Type | Method and Description |
---|---|
String |
getQueryString()
Returns the query string.
|
ByteBuffer |
getRoutingKey()
Returns the routing key for the query.
|
SimpleStatement |
setRoutingKey(ByteBuffer... routingKeyComponents)
Sets the routing key for this query.
|
SimpleStatement |
setRoutingKey(ByteBuffer routingKey)
Sets the routing key for this query.
|
disableTracing, enableTracing, getConsistencyLevel, getRetryPolicy, isTracing, setConsistencyLevel, setRetryPolicy
public SimpleStatement(String query)
SimpleStatement
with the provided query string.query
- the query string.public String getQueryString()
getQueryString
in class Statement
public ByteBuffer getRoutingKey()
Unless the routing key has been explicitly set through
setRoutingKey(java.nio.ByteBuffer)
, this method will return null
to
avoid having to parse the query string to retrieve the partition key.
getRoutingKey
in class Query
setRoutingKey(java.nio.ByteBuffer)
is such a key
was set, null
otherwise.Query.getRoutingKey()
public SimpleStatement setRoutingKey(ByteBuffer routingKey)
This method allows you to manually provide a routing key for this query. It is thus optional since the routing key is only an hint for token aware load balancing policy but is never mandatory.
If the partition key for the query is composite, use the
setRoutingKey(ByteBuffer...)
method instead to build the
routing key.
routingKey
- the raw (binary) value to use as routing key.SimpleStatement
object.Query.getRoutingKey()
public SimpleStatement setRoutingKey(ByteBuffer... routingKeyComponents)
See setRoutingKey(ByteBuffer)
for more information. This
method is a variant for when the query partition key is composite and
thus the routing key must be built from multiple values.
routingKeyComponents
- the raw (binary) values to compose to obtain
the routing key.SimpleStatement
object.Query.getRoutingKey()
Copyright © 2014. All Rights Reserved.