32
32
* Synchronous interface for running commands against an object that is linked to a specific DynamoDb table resource
33
33
* and therefore knows how to map records from that table into a modelled object.
34
34
* <p>
35
- * By default, all command methods throw an {@link UnsupportedOperationException} to prevent interface extensions from breaking
36
- * implementing classes.
35
+ * By default, all command methods throw an {@link UnsupportedOperationException} to prevent interface extensions from
36
+ * breaking implementing classes.
37
37
* <p>
38
38
* @param <T> The type of the modelled object.
39
39
*/
@@ -55,10 +55,10 @@ public interface DynamoDbTable<T> extends MappedTableResource<T> {
55
55
* <p>
56
56
* Use {@link DynamoDbEnhancedClient#table(String, TableSchema)} to define the mapped table resource.
57
57
* <p>
58
- * This operation calls the low-level DynamoDB API CreateTable operation. Note that this is an asynchronous operation and that
59
- * the table may not immediately be available for writes and reads. Currently, there is no mechanism supported within this
60
- * library to wait for/check the status of a created table. You must provide this functionality yourself.
61
- * Consult the CreateTable documentation for further details and constraints.
58
+ * This operation calls the low-level DynamoDB API CreateTable operation. Note that this is an asynchronous
59
+ * operation and that the table may not immediately be available for writes and reads. Currently, there is no
60
+ * mechanism supported within this library to wait for/check the status of a created table. You must provide this
61
+ * functionality yourself. Consult the CreateTable documentation for further details and constraints.
62
62
* <p>
63
63
* Example:
64
64
* <pre>
@@ -86,13 +86,13 @@ default void createTable(CreateTableEnhancedRequest request) {
86
86
* <p>
87
87
* Use {@link DynamoDbEnhancedClient#table(String, TableSchema)} to define the mapped table resource.
88
88
* <p>
89
- * This operation calls the low-level DynamoDB API CreateTable operation. Note that this is an asynchronous operation and that
90
- * the table may not immediately be available for writes and reads. Currently, there is no mechanism supported within this
91
- * library to wait for/check the status of a created table. You must provide this functionality yourself.
92
- * Consult the CreateTable documentation for further details and constraints.
89
+ * This operation calls the low-level DynamoDB API CreateTable operation. Note that this is an asynchronous
90
+ * operation and that the table may not immediately be available for writes and reads. Currently, there is no
91
+ * mechanism supported within this library to wait for/check the status of a created table. You must provide this
92
+ * functionality yourself. Consult the CreateTable documentation for further details and constraints.
93
93
* <p>
94
- * <b>Note:</b> This is a convenience method that creates an instance of the request builder avoiding the need to create one
95
- * manually via {@link CreateTableEnhancedRequest#builder()}.
94
+ * <b>Note:</b> This is a convenience method that creates an instance of the request builder avoiding the need to
95
+ * create one manually via {@link CreateTableEnhancedRequest#builder()}.
96
96
* <p>
97
97
* Example:
98
98
* <pre>
@@ -106,8 +106,8 @@ default void createTable(CreateTableEnhancedRequest request) {
106
106
* }
107
107
* </pre>
108
108
*
109
- * @param requestConsumer A {@link Consumer} of {@link CreateTableEnhancedRequest.Builder} containing optional parameters
110
- * for table creation.
109
+ * @param requestConsumer A {@link Consumer} of {@link CreateTableEnhancedRequest.Builder} containing optional
110
+ * parameters for table creation.
111
111
*/
112
112
default void createTable (Consumer <CreateTableEnhancedRequest .Builder > requestConsumer ) {
113
113
throw new UnsupportedOperationException ();
@@ -118,10 +118,10 @@ default void createTable(Consumer<CreateTableEnhancedRequest.Builder> requestCon
118
118
* <p>
119
119
* Use {@link DynamoDbEnhancedClient#table(String, TableSchema)} to define the mapped table resource.
120
120
* <p>
121
- * This operation calls the low-level DynamoDB API CreateTable operation. Note that this is an asynchronous operation and that
122
- * the table may not immediately be available for writes and reads. Currently, there is no mechanism supported within this
123
- * library to wait for/check the status of a created table. You must provide this functionality yourself.
124
- * Consult the CreateTable documentation for further details and constraints.
121
+ * This operation calls the low-level DynamoDB API CreateTable operation. Note that this is an asynchronous
122
+ * operation and that the table may not immediately be available for writes and reads. Currently, there is no
123
+ * mechanism supported within this library to wait for/check the status of a created table. You must provide this
124
+ * functionality yourself. Consult the CreateTable documentation for further details and constraints.
125
125
* <p>
126
126
* Example:
127
127
* <pre>
@@ -149,12 +149,13 @@ default void createTable() {
149
149
* <pre>
150
150
* {@code
151
151
*
152
- * mappedTable.delete(DeleteItemEnhancedRequest.builder().key(key).build());
152
+ * MyItem previouslyPersistedItem = mappedTable.delete(DeleteItemEnhancedRequest.builder().key(key).build());
153
153
* }
154
154
* </pre>
155
155
*
156
- * @param request A {@link DeleteItemEnhancedRequest} with key and optional directives for deleting an item from the table.
157
- * @return The deleted item
156
+ * @param request A {@link DeleteItemEnhancedRequest} with key and optional directives for deleting an item from the
157
+ * table.
158
+ * @return The item that was persisted in the database before it was deleted.
158
159
*/
159
160
default T deleteItem (DeleteItemEnhancedRequest request ) {
160
161
throw new UnsupportedOperationException ();
@@ -169,20 +170,20 @@ default T deleteItem(DeleteItemEnhancedRequest request) {
169
170
* This operation calls the low-level DynamoDB API DeleteItem operation. Consult the DeleteItem documentation for
170
171
* further details and constraints.
171
172
* <p>
172
- * <b>Note:</b> This is a convenience method that creates an instance of the request builder avoiding the need to create one
173
- * manually via {@link DeleteItemEnhancedRequest#builder()}.
173
+ * <b>Note:</b> This is a convenience method that creates an instance of the request builder avoiding the need to
174
+ * create one manually via {@link DeleteItemEnhancedRequest#builder()}.
174
175
* <p>
175
176
* Example:
176
177
* <pre>
177
178
* {@code
178
179
*
179
- * mappedTable.delete(r -> r.key(key));
180
+ * MyItem previouslyPersistedItem = mappedTable.delete(r -> r.key(key));
180
181
* }
181
182
* </pre>
182
183
*
183
184
* @param requestConsumer A {@link Consumer} of {@link DeleteItemEnhancedRequest} with key and
184
185
* optional directives for deleting an item from the table.
185
- * @return The deleted item
186
+ * @return The item that was persisted in the database before it was deleted.
186
187
*/
187
188
default T deleteItem (Consumer <DeleteItemEnhancedRequest .Builder > requestConsumer ) {
188
189
throw new UnsupportedOperationException ();
@@ -198,17 +199,39 @@ default T deleteItem(Consumer<DeleteItemEnhancedRequest.Builder> requestConsumer
198
199
* <pre>
199
200
* {@code
200
201
*
201
- * mappedTable.delete(key);
202
+ * MyItem previouslyPersistedItem = mappedTable.delete(key);
202
203
* }
203
204
* </pre>
204
205
*
205
206
* @param key A {@link Key} that will be used to match a specific record to delete from the database table.
206
- * @return The deleted item
207
+ * @return The item that was persisted in the database before it was deleted.
207
208
*/
208
209
default T deleteItem (Key key ) {
209
210
throw new UnsupportedOperationException ();
210
211
}
211
212
213
+ /**
214
+ * Deletes a single item from the mapped table using just the key of a supplied modelled 'key item' object.
215
+ * <p>
216
+ * This operation calls the low-level DynamoDB API DeleteItem operation. Consult the DeleteItem documentation for
217
+ * further details and constraints.
218
+ * <p>
219
+ * Example:
220
+ * <pre>
221
+ * {@code
222
+ *
223
+ * MyItem previouslyPersistedItem = mappedTable.deleteItem(keyItem);
224
+ * }
225
+ * </pre>
226
+ *
227
+ * @param keyItem A modelled item with the primary key fields set that will be used to match a specific record to
228
+ * delete from the database table.
229
+ * @return The item that was persisted in the database before it was deleted.
230
+ */
231
+ default T deleteItem (T keyItem ) {
232
+ throw new UnsupportedOperationException ();
233
+ }
234
+
212
235
/**
213
236
* Retrieves a single item from the mapped table using a supplied primary {@link Key}.
214
237
* <p>
@@ -243,8 +266,8 @@ default T getItem(GetItemEnhancedRequest request) {
243
266
* This operation calls the low-level DynamoDB API GetItem operation. Consult the GetItem documentation for
244
267
* further details and constraints.
245
268
* <p>
246
- * <b>Note:</b> This is a convenience method that creates an instance of the request builder avoiding the need to create one
247
- * manually via {@link GetItemEnhancedRequest#builder()}.
269
+ * <b>Note:</b> This is a convenience method that creates an instance of the request builder avoiding the need to
270
+ * create one manually via {@link GetItemEnhancedRequest#builder()}.
248
271
* <p>
249
272
* Example:
250
273
* <pre>
@@ -254,8 +277,8 @@ default T getItem(GetItemEnhancedRequest request) {
254
277
* }
255
278
* </pre>
256
279
*
257
- * @param requestConsumer A {@link Consumer} of {@link GetItemEnhancedRequest.Builder} with key and optional directives
258
- * for retrieving an item from the table.
280
+ * @param requestConsumer A {@link Consumer} of {@link GetItemEnhancedRequest.Builder} with key and optional
281
+ * directives for retrieving an item from the table.
259
282
* @return The retrieved item
260
283
*/
261
284
default T getItem (Consumer <GetItemEnhancedRequest .Builder > requestConsumer ) {
@@ -284,8 +307,30 @@ default T getItem(Key key) {
284
307
}
285
308
286
309
/**
287
- * Executes a query against the primary index of the table using a {@link QueryConditional} expression to retrieve a list of
288
- * items matching the given conditions.
310
+ * Retrieves a single item from the mapped table using just the key of a supplied modelled 'key item'.
311
+ * <p>
312
+ * This operation calls the low-level DynamoDB API GetItem operation. Consult the GetItem documentation for
313
+ * further details and constraints.
314
+ * <p>
315
+ * Example:
316
+ * <pre>
317
+ * {@code
318
+ *
319
+ * MyItem item = mappedTable.getItem(keyItem);
320
+ * }
321
+ * </pre>
322
+ *
323
+ * @param keyItem A modelled item with the primary key fields set that will be used to match a specific record to
324
+ * retrieve from the database table.
325
+ * @return The retrieved item
326
+ */
327
+ default T getItem (T keyItem ) {
328
+ throw new UnsupportedOperationException ();
329
+ }
330
+
331
+ /**
332
+ * Executes a query against the primary index of the table using a {@link QueryConditional} expression to retrieve a
333
+ * list of items matching the given conditions.
289
334
* <p>
290
335
* The result is accessed through iterable pages (see {@link Page}) in an interactive way; each time a
291
336
* result page is retrieved, a query call is made to DynamoDb to get those entries. If no matches are found,
@@ -318,8 +363,8 @@ default SdkIterable<Page<T>> query(QueryEnhancedRequest request) {
318
363
}
319
364
320
365
/**
321
- * Executes a query against the primary index of the table using a {@link QueryConditional} expression to retrieve a list of
322
- * items matching the given conditions.
366
+ * Executes a query against the primary index of the table using a {@link QueryConditional} expression to retrieve a
367
+ * list of items matching the given conditions.
323
368
* <p>
324
369
* The result is accessed through iterable pages (see {@link Page}) in an interactive way; each time a
325
370
* result page is retrieved, a query call is made to DynamoDb to get those entries. If no matches are found,
@@ -332,8 +377,8 @@ default SdkIterable<Page<T>> query(QueryEnhancedRequest request) {
332
377
* This operation calls the low-level DynamoDB API Query operation. Consult the Query documentation for
333
378
* further details and constraints.
334
379
* <p>
335
- * <b>Note:</b> This is a convenience method that creates an instance of the request builder avoiding the need to create one
336
- * manually via {@link DeleteItemEnhancedRequest#builder()}.
380
+ * <b>Note:</b> This is a convenience method that creates an instance of the request builder avoiding the need to
381
+ * create one manually via {@link DeleteItemEnhancedRequest#builder()}.
337
382
* <p>
338
383
* Example:
339
384
* <pre>
@@ -344,8 +389,8 @@ default SdkIterable<Page<T>> query(QueryEnhancedRequest request) {
344
389
* }
345
390
* </pre>
346
391
*
347
- * @param requestConsumer A {@link Consumer} of {@link QueryEnhancedRequest} defining the query conditions and how to
348
- * handle the results.
392
+ * @param requestConsumer A {@link Consumer} of {@link QueryEnhancedRequest} defining the query conditions and how
393
+ * to handle the results.
349
394
* @return an iterator of type {@link SdkIterable} with paginated results (see {@link Page}).
350
395
*/
351
396
default SdkIterable <Page <T >> query (Consumer <QueryEnhancedRequest .Builder > requestConsumer ) {
@@ -381,8 +426,8 @@ default SdkIterable<Page<T>> query(QueryConditional queryConditional) {
381
426
}
382
427
383
428
/**
384
- * Puts a single item in the mapped table. If the table contains an item with the same primary key, it will be replaced with
385
- * this item.
429
+ * Puts a single item in the mapped table. If the table contains an item with the same primary key, it will be
430
+ * replaced with this item.
386
431
* <p>
387
432
* The additional configuration parameters that the enhanced client supports are defined
388
433
* in the {@link PutItemEnhancedRequest}.
@@ -406,8 +451,8 @@ default void putItem(PutItemEnhancedRequest<T> request) {
406
451
}
407
452
408
453
/**
409
- * Puts a single item in the mapped table. If the table contains an item with the same primary key, it will be replaced with
410
- * this item.
454
+ * Puts a single item in the mapped table. If the table contains an item with the same primary key, it will be
455
+ * replaced with this item.
411
456
* <p>
412
457
* The additional configuration parameters that the enhanced client supports are defined
413
458
* in the {@link PutItemEnhancedRequest}.
0 commit comments