15
15
16
16
package software .amazon .awssdk .enhanced .dynamodb .internal .converter .attribute ;
17
17
18
+ import java .util .ArrayList ;
18
19
import java .util .Arrays ;
20
+ import java .util .Collection ;
19
21
import java .util .Collections ;
20
22
import java .util .List ;
21
23
import java .util .Map ;
@@ -195,6 +197,22 @@ public static EnhancedAttributeValue fromSetOfStrings(String... setOfStringsValu
195
197
return fromSetOfStrings (Arrays .asList (setOfStringsValue ));
196
198
}
197
199
200
+ /**
201
+ * Create an {@link EnhancedAttributeValue} for a set-of-strings (ss) DynamoDB type.
202
+ *
203
+ * <p>
204
+ * Equivalent to: {@code EnhancedAttributeValue.fromGeneratedAttributeValue(AttributeValue.builder().ss(...).build())}
205
+ *
206
+ * <p>
207
+ * This call will fail with a {@link RuntimeException} if the provided value is null or contains a null value. Use
208
+ * {@link #fromListOfAttributeValues(List)} for null values. This <i>will not</i> validate that there are no
209
+ * duplicate values.
210
+ */
211
+ public static EnhancedAttributeValue fromSetOfStrings (Collection <String > setOfStringsValue ) {
212
+ Validate .paramNotNull (setOfStringsValue , "setOfStringsValue" );
213
+ return fromSetOfStrings (new ArrayList <>(setOfStringsValue ));
214
+ }
215
+
198
216
/**
199
217
* Create an {@link EnhancedAttributeValue} for a set-of-strings (ss) DynamoDB type.
200
218
*
@@ -228,6 +246,22 @@ public static EnhancedAttributeValue fromSetOfNumbers(String... setOfNumbersValu
228
246
return fromSetOfNumbers (Arrays .asList (setOfNumbersValue ));
229
247
}
230
248
249
+ /**
250
+ * Create an {@link EnhancedAttributeValue} for a set-of-numbers (ns) DynamoDB type.
251
+ *
252
+ * <p>
253
+ * Equivalent to: {@code EnhancedAttributeValue.fromGeneratedAttributeValue(AttributeValue.builder().ns(...).build())}
254
+ *
255
+ * <p>
256
+ * This call will fail with a {@link RuntimeException} if the provided value is null or contains a null value. Use
257
+ * {@link #fromListOfAttributeValues(List)} for null values. This <i>will not</i> validate that there are no
258
+ * duplicate values.
259
+ */
260
+ public static EnhancedAttributeValue fromSetOfNumbers (Collection <String > setOfNumbersValue ) {
261
+ Validate .paramNotNull (setOfNumbersValue , "setOfNumbersValue" );
262
+ return fromSetOfNumbers (new ArrayList <>(setOfNumbersValue ));
263
+ }
264
+
231
265
/**
232
266
* Create an {@link EnhancedAttributeValue} for a set-of-numbers (ns) DynamoDB type.
233
267
*
@@ -245,6 +279,22 @@ public static EnhancedAttributeValue fromSetOfNumbers(List<String> setOfNumbersV
245
279
return new InternalBuilder ().setOfNumbersValue (setOfNumbersValue ).build ();
246
280
}
247
281
282
+ /**
283
+ * Create an {@link EnhancedAttributeValue} for a set-of-bytes (bs) DynamoDB type.
284
+ *
285
+ * <p>
286
+ * Equivalent to: {@code EnhancedAttributeValue.fromGeneratedAttributeValue(AttributeValue.builder().bs(...).build())}
287
+ *
288
+ * <p>
289
+ * This call will fail with a {@link RuntimeException} if the provided value is null or contains a null value. Use
290
+ * {@link #fromListOfAttributeValues(List)} for null values. This <i>will not</i> validate that there are no
291
+ * duplicate values.
292
+ */
293
+ public static EnhancedAttributeValue fromSetOfBytes (Collection <SdkBytes > setOfBytesValue ) {
294
+ Validate .paramNotNull (setOfBytesValue , "setOfBytesValue" );
295
+ return fromSetOfBytes (new ArrayList <>(setOfBytesValue ));
296
+ }
297
+
248
298
/**
249
299
* Create an {@link EnhancedAttributeValue} for a set-of-bytes (bs) DynamoDB type.
250
300
*
0 commit comments