4141/**
4242 * A request to execute a CQL query.
4343 *
44- * @param <T > the "self type" used for covariant returns in subtypes.
44+ * @param <SelfT > the "self type" used for covariant returns in subtypes.
4545 */
46- public interface Statement <T extends Statement <T >> extends Request {
46+ public interface Statement <SelfT extends Statement <SelfT >> extends Request {
4747 // Implementation note: "CqlRequest" would be a better name, but we keep "Statement" to match
4848 // previous driver versions.
4949
@@ -76,7 +76,7 @@ public interface Statement<T extends Statement<T>> extends Request {
7676 * method. However custom implementations may choose to be mutable and return the same instance.
7777 */
7878 @ NonNull
79- T setExecutionProfileName (@ Nullable String newConfigProfileName );
79+ SelfT setExecutionProfileName (@ Nullable String newConfigProfileName );
8080
8181 /**
8282 * Sets the execution profile to use for this statement.
@@ -85,7 +85,7 @@ public interface Statement<T extends Statement<T>> extends Request {
8585 * method. However custom implementations may choose to be mutable and return the same instance.
8686 */
8787 @ NonNull
88- T setExecutionProfile (@ Nullable DriverExecutionProfile newProfile );
88+ SelfT setExecutionProfile (@ Nullable DriverExecutionProfile newProfile );
8989
9090 /**
9191 * Sets the keyspace to use for token-aware routing.
@@ -95,7 +95,7 @@ public interface Statement<T extends Statement<T>> extends Request {
9595 * @param newRoutingKeyspace The keyspace to use, or {@code null} to disable token-aware routing.
9696 */
9797 @ NonNull
98- T setRoutingKeyspace (@ Nullable CqlIdentifier newRoutingKeyspace );
98+ SelfT setRoutingKeyspace (@ Nullable CqlIdentifier newRoutingKeyspace );
9999
100100 /**
101101 * Sets the {@link Node} that should handle this query.
@@ -119,7 +119,7 @@ public interface Statement<T extends Statement<T>> extends Request {
119119 * delegate to the configured load balancing policy.
120120 */
121121 @ NonNull
122- T setNode (@ Nullable Node node );
122+ SelfT setNode (@ Nullable Node node );
123123
124124 /**
125125 * Shortcut for {@link #setRoutingKeyspace(CqlIdentifier)
@@ -129,7 +129,7 @@ public interface Statement<T extends Statement<T>> extends Request {
129129 * routing.
130130 */
131131 @ NonNull
132- default T setRoutingKeyspace (@ Nullable String newRoutingKeyspaceName ) {
132+ default SelfT setRoutingKeyspace (@ Nullable String newRoutingKeyspaceName ) {
133133 return setRoutingKeyspace (
134134 newRoutingKeyspaceName == null ? null : CqlIdentifier .fromCql (newRoutingKeyspaceName ));
135135 }
@@ -142,7 +142,7 @@ default T setRoutingKeyspace(@Nullable String newRoutingKeyspaceName) {
142142 * @param newRoutingKey The routing key to use, or {@code null} to disable token-aware routing.
143143 */
144144 @ NonNull
145- T setRoutingKey (@ Nullable ByteBuffer newRoutingKey );
145+ SelfT setRoutingKey (@ Nullable ByteBuffer newRoutingKey );
146146
147147 /**
148148 * Sets the key to use for token-aware routing, when the partition key has multiple components.
@@ -152,7 +152,7 @@ default T setRoutingKeyspace(@Nullable String newRoutingKeyspaceName) {
152152 * can be {@code null}.
153153 */
154154 @ NonNull
155- default T setRoutingKey (@ NonNull ByteBuffer ... newRoutingKeyComponents ) {
155+ default SelfT setRoutingKey (@ NonNull ByteBuffer ... newRoutingKeyComponents ) {
156156 return setRoutingKey (RoutingKey .compose (newRoutingKeyComponents ));
157157 }
158158
@@ -165,7 +165,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
165165 * routing.
166166 */
167167 @ NonNull
168- T setRoutingToken (@ Nullable Token newRoutingToken );
168+ SelfT setRoutingToken (@ Nullable Token newRoutingToken );
169169
170170 /**
171171 * Sets the custom payload to use for execution.
@@ -179,7 +179,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
179179 * it's never modified after being set on the statement).
180180 */
181181 @ NonNull
182- T setCustomPayload (@ NonNull Map <String , ByteBuffer > newCustomPayload );
182+ SelfT setCustomPayload (@ NonNull Map <String , ByteBuffer > newCustomPayload );
183183
184184 /**
185185 * Sets the idempotence to use for execution.
@@ -191,7 +191,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
191191 * use the default idempotence defined in the configuration.
192192 */
193193 @ NonNull
194- T setIdempotent (@ Nullable Boolean newIdempotence );
194+ SelfT setIdempotent (@ Nullable Boolean newIdempotence );
195195
196196 /**
197197 * Sets tracing for execution.
@@ -200,7 +200,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
200200 * method. However custom implementations may choose to be mutable and return the same instance.
201201 */
202202 @ NonNull
203- T setTracing (boolean newTracing );
203+ SelfT setTracing (boolean newTracing );
204204
205205 /**
206206 * Returns the query timestamp, in microseconds, to send with the statement.
@@ -224,7 +224,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
224224 * @see TimestampGenerator
225225 */
226226 @ NonNull
227- T setTimestamp (long newTimestamp );
227+ SelfT setTimestamp (long newTimestamp );
228228
229229 /**
230230 * Sets how long to wait for this request to complete. This is a global limit on the duration of a
@@ -235,7 +235,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
235235 * @see DefaultDriverOption#REQUEST_TIMEOUT
236236 */
237237 @ NonNull
238- T setTimeout (@ Nullable Duration newTimeout );
238+ SelfT setTimeout (@ Nullable Duration newTimeout );
239239
240240 /**
241241 * Returns the paging state to send with the statement, or {@code null} if this statement has no
@@ -265,7 +265,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
265265 * if you do so, you must override {@link #copy(ByteBuffer)}.
266266 */
267267 @ NonNull
268- T setPagingState (@ Nullable ByteBuffer newPagingState );
268+ SelfT setPagingState (@ Nullable ByteBuffer newPagingState );
269269
270270 /**
271271 * Returns the page size to use for the statement.
@@ -285,7 +285,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
285285 * @see DefaultDriverOption#REQUEST_PAGE_SIZE
286286 */
287287 @ NonNull
288- T setPageSize (int newPageSize );
288+ SelfT setPageSize (int newPageSize );
289289
290290 /**
291291 * Returns the {@link ConsistencyLevel} to use for the statement.
@@ -304,7 +304,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
304304 * defined in the configuration.
305305 * @see DefaultDriverOption#REQUEST_CONSISTENCY
306306 */
307- T setConsistencyLevel (@ Nullable ConsistencyLevel newConsistencyLevel );
307+ SelfT setConsistencyLevel (@ Nullable ConsistencyLevel newConsistencyLevel );
308308
309309 /**
310310 * Returns the serial {@link ConsistencyLevel} to use for the statement.
@@ -324,7 +324,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
324324 * @see DefaultDriverOption#REQUEST_SERIAL_CONSISTENCY
325325 */
326326 @ NonNull
327- T setSerialConsistencyLevel (@ Nullable ConsistencyLevel newSerialConsistencyLevel );
327+ SelfT setSerialConsistencyLevel (@ Nullable ConsistencyLevel newSerialConsistencyLevel );
328328
329329 /** Whether tracing information should be recorded for this statement. */
330330 boolean isTracing ();
@@ -351,7 +351,7 @@ default T setRoutingKey(@NonNull ByteBuffer... newRoutingKeyComponents) {
351351 * your own mutable implementation, make sure it returns a different instance.
352352 */
353353 @ NonNull
354- default T copy (@ Nullable ByteBuffer newPagingState ) {
354+ default SelfT copy (@ Nullable ByteBuffer newPagingState ) {
355355 return setPagingState (newPagingState );
356356 }
357357}
0 commit comments