1919
2020import org .springframework .data .cassandra .core .cql .QueryOptions ;
2121import org .springframework .data .cassandra .core .cql .WriteOptions ;
22+ import org .springframework .lang .Contract ;
2223import org .springframework .util .Assert ;
2324
2425import com .datastax .oss .driver .api .core .cql .BatchableStatement ;
@@ -58,6 +59,7 @@ public interface CassandraBatchOperations {
5859 * @return {@code this} {@link CassandraBatchOperations}.
5960 * @throws IllegalStateException if the batch was already executed.
6061 */
62+ @ Contract ("_ -> this" )
6163 CassandraBatchOperations withTimestamp (long timestamp );
6264
6365 /**
@@ -68,6 +70,7 @@ public interface CassandraBatchOperations {
6870 * @throws IllegalStateException if the batch was already executed.
6971 * @since 4.4
7072 */
73+ @ Contract ("_ -> this" )
7174 CassandraBatchOperations withQueryOptions (QueryOptions options );
7275
7376 /**
@@ -78,6 +81,7 @@ public interface CassandraBatchOperations {
7881 * @throws IllegalStateException if the batch was already executed.
7982 * @since 4.4
8083 */
84+ @ Contract ("_ -> this" )
8185 CassandraBatchOperations addStatement (BatchableStatement <?> statement );
8286
8387 /**
@@ -88,6 +92,7 @@ public interface CassandraBatchOperations {
8892 * @throws IllegalStateException if the batch was already executed.
8993 * @since 4.4
9094 */
95+ @ Contract ("_ -> this" )
9196 CassandraBatchOperations addStatements (BatchableStatement <?>... statements );
9297
9398 /**
@@ -98,6 +103,7 @@ public interface CassandraBatchOperations {
98103 * @throws IllegalStateException if the batch was already executed.
99104 * @since 4.4
100105 */
106+ @ Contract ("_ -> this" )
101107 CassandraBatchOperations addStatements (Iterable <? extends BatchableStatement <?>> statements );
102108
103109 /**
@@ -109,6 +115,7 @@ public interface CassandraBatchOperations {
109115 * @throws IllegalStateException if the batch was already executed.
110116 * @since 3.2.2
111117 */
118+ @ Contract ("_, _ -> this" )
112119 default CassandraBatchOperations insert (Object entity , WriteOptions options ) {
113120
114121 Assert .notNull (entity , "Entity must not be null" );
@@ -123,6 +130,7 @@ default CassandraBatchOperations insert(Object entity, WriteOptions options) {
123130 * @return {@code this} {@link CassandraBatchOperations}.
124131 * @throws IllegalStateException if the batch was already executed.
125132 */
133+ @ Contract ("_ -> this" )
126134 CassandraBatchOperations insert (Object ... entities );
127135
128136 /**
@@ -132,6 +140,7 @@ default CassandraBatchOperations insert(Object entity, WriteOptions options) {
132140 * @return {@code this} {@link CassandraBatchOperations}.
133141 * @throws IllegalStateException if the batch was already executed.
134142 */
143+ @ Contract ("_ -> this" )
135144 CassandraBatchOperations insert (Iterable <?> entities );
136145
137146 /**
@@ -144,6 +153,7 @@ default CassandraBatchOperations insert(Object entity, WriteOptions options) {
144153 * @since 2.0
145154 * @see InsertOptions
146155 */
156+ @ Contract ("_, _ -> this" )
147157 CassandraBatchOperations insert (Iterable <?> entities , WriteOptions options );
148158
149159 /**
@@ -155,6 +165,7 @@ default CassandraBatchOperations insert(Object entity, WriteOptions options) {
155165 * @throws IllegalStateException if the batch was already executed.
156166 * @since 3.2.2
157167 */
168+ @ Contract ("_, _ -> this" )
158169 default CassandraBatchOperations update (Object entity , WriteOptions options ) {
159170
160171 Assert .notNull (entity , "Entity must not be null" );
@@ -169,6 +180,7 @@ default CassandraBatchOperations update(Object entity, WriteOptions options) {
169180 * @return {@code this} {@link CassandraBatchOperations}.
170181 * @throws IllegalStateException if the batch was already executed.
171182 */
183+ @ Contract ("_ -> this" )
172184 CassandraBatchOperations update (Object ... entities );
173185
174186 /**
@@ -178,6 +190,7 @@ default CassandraBatchOperations update(Object entity, WriteOptions options) {
178190 * @return {@code this} {@link CassandraBatchOperations}.
179191 * @throws IllegalStateException if the batch was already executed.
180192 */
193+ @ Contract ("_ -> this" )
181194 CassandraBatchOperations update (Iterable <?> entities );
182195
183196 /**
@@ -190,6 +203,7 @@ default CassandraBatchOperations update(Object entity, WriteOptions options) {
190203 * @since 2.0
191204 * @see UpdateOptions
192205 */
206+ @ Contract ("_, _ -> this" )
193207 CassandraBatchOperations update (Iterable <?> entities , WriteOptions options );
194208
195209 /**
@@ -201,6 +215,7 @@ default CassandraBatchOperations update(Object entity, WriteOptions options) {
201215 * @throws IllegalStateException if the batch was already executed.
202216 * @since 3.2.2
203217 */
218+ @ Contract ("_, _ -> this" )
204219 default CassandraBatchOperations delete (Object entity , WriteOptions options ) {
205220
206221 Assert .notNull (entity , "Entity must not be null" );
@@ -215,6 +230,7 @@ default CassandraBatchOperations delete(Object entity, WriteOptions options) {
215230 * @return {@code this} {@link CassandraBatchOperations}.
216231 * @throws IllegalStateException if the batch was already executed.
217232 */
233+ @ Contract ("_ -> this" )
218234 CassandraBatchOperations delete (Object ... entities );
219235
220236 /**
@@ -224,6 +240,7 @@ default CassandraBatchOperations delete(Object entity, WriteOptions options) {
224240 * @return {@code this} {@link CassandraBatchOperations}.
225241 * @throws IllegalStateException if the batch was already executed.
226242 */
243+ @ Contract ("_ -> this" )
227244 CassandraBatchOperations delete (Iterable <?> entities );
228245
229246 /**
@@ -236,5 +253,6 @@ default CassandraBatchOperations delete(Object entity, WriteOptions options) {
236253 * @since 2.2
237254 * @see DeleteOptions
238255 */
256+ @ Contract ("_, _ -> this" )
239257 CassandraBatchOperations delete (Iterable <?> entities , WriteOptions options );
240258}
0 commit comments