30
30
import com .google .cloud .storage .UnifiedOpts .BucketSourceOpt ;
31
31
import com .google .cloud .storage .UnifiedOpts .ObjectOptExtractor ;
32
32
import com .google .cloud .storage .UnifiedOpts .ObjectTargetOpt ;
33
- import com .google .cloud .storage .UnifiedOpts .OptionShim ;
34
33
import com .google .common .collect .ImmutableList ;
35
34
import com .google .common .collect .Lists ;
36
35
import java .io .IOException ;
41
40
import java .time .Duration ;
42
41
import java .time .OffsetDateTime ;
43
42
import java .util .Arrays ;
43
+ import java .util .Collection ;
44
44
import java .util .List ;
45
45
import java .util .Map ;
46
46
import java .util .Objects ;
@@ -99,6 +99,41 @@ public static BucketSourceOption userProject(@NonNull String userProject) {
99
99
return new BucketSourceOption (UnifiedOpts .userProject (userProject ));
100
100
}
101
101
102
+ /**
103
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
104
+ * os} will be the value included in the return.
105
+ */
106
+ @ BetaApi
107
+ public static BucketSourceOption [] dedupe (BucketSourceOption ... os ) {
108
+ return Option .dedupe (BucketSourceOption []::new , os );
109
+ }
110
+
111
+ /**
112
+ * Deduplicate any options which are the same parameter.
113
+ *
114
+ * <p>The value which comes last in {@code collection} and {@code os} will be the value included
115
+ * in the return. All options from {@code os} will override their counterparts in {@code
116
+ * collection}.
117
+ */
118
+ @ BetaApi
119
+ public static BucketSourceOption [] dedupe (
120
+ Collection <BucketSourceOption > collection , BucketSourceOption ... os ) {
121
+ return Option .dedupe (BucketSourceOption []::new , collection , os );
122
+ }
123
+
124
+ /**
125
+ * Deduplicate any options which are the same parameter.
126
+ *
127
+ * <p>The value which comes last in {@code collection} and {@code os} will be the value included
128
+ * in the return. All options from {@code os} will override their counterparts in {@code
129
+ * collection}.
130
+ */
131
+ @ BetaApi
132
+ public static BucketSourceOption [] dedupe (
133
+ BucketSourceOption [] array , BucketSourceOption ... os ) {
134
+ return Option .dedupe (BucketSourceOption []::new , array , os );
135
+ }
136
+
102
137
static Storage .BucketSourceOption [] toSourceOptions (
103
138
BucketInfo bucketInfo , BucketSourceOption ... options ) {
104
139
Storage .BucketSourceOption [] convertedOptions =
@@ -237,6 +272,40 @@ public static BlobTargetOption userProject(@NonNull String userProject) {
237
272
return new BlobTargetOption (UnifiedOpts .userProject (userProject ));
238
273
}
239
274
275
+ /**
276
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
277
+ * os} will be the value included in the return.
278
+ */
279
+ @ BetaApi
280
+ public static BlobTargetOption [] dedupe (BlobTargetOption ... os ) {
281
+ return Option .dedupe (BlobTargetOption []::new , os );
282
+ }
283
+
284
+ /**
285
+ * Deduplicate any options which are the same parameter.
286
+ *
287
+ * <p>The value which comes last in {@code collection} and {@code os} will be the value included
288
+ * in the return. All options from {@code os} will override their counterparts in {@code
289
+ * collection}.
290
+ */
291
+ @ BetaApi
292
+ public static BlobTargetOption [] dedupe (
293
+ Collection <BlobTargetOption > collection , BlobTargetOption ... os ) {
294
+ return Option .dedupe (BlobTargetOption []::new , collection , os );
295
+ }
296
+
297
+ /**
298
+ * Deduplicate any options which are the same parameter.
299
+ *
300
+ * <p>The value which comes last in {@code collection} and {@code os} will be the value included
301
+ * in the return. All options from {@code os} will override their counterparts in {@code
302
+ * collection}.
303
+ */
304
+ @ BetaApi
305
+ public static BlobTargetOption [] dedupe (BlobTargetOption [] array , BlobTargetOption ... os ) {
306
+ return Option .dedupe (BlobTargetOption []::new , array , os );
307
+ }
308
+
240
309
static Storage .BlobTargetOption [] toTargetOptions (
241
310
BlobInfo blobInfo , BlobTargetOption ... options ) {
242
311
Storage .BlobTargetOption [] targetOptions = new Storage .BlobTargetOption [options .length ];
@@ -255,7 +324,7 @@ static Storage.BlobTargetOption[] toTargetOptions(
255
324
}
256
325
257
326
/** Class for specifying blob write options when {@code Bucket} methods are used. */
258
- public static class BlobWriteOption extends OptionShim <ObjectTargetOpt > implements Serializable {
327
+ public static class BlobWriteOption extends Option <ObjectTargetOpt > implements Serializable {
259
328
260
329
private static final long serialVersionUID = 59762268190041584L ;
261
330
@@ -366,6 +435,40 @@ public static BlobWriteOption userProject(@NonNull String userProject) {
366
435
return new BlobWriteOption (UnifiedOpts .userProject (userProject ));
367
436
}
368
437
438
+ /**
439
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
440
+ * os} will be the value included in the return.
441
+ */
442
+ @ BetaApi
443
+ public static BlobWriteOption [] dedupe (BlobWriteOption ... os ) {
444
+ return Option .dedupe (BlobWriteOption []::new , os );
445
+ }
446
+
447
+ /**
448
+ * Deduplicate any options which are the same parameter.
449
+ *
450
+ * <p>The value which comes last in {@code collection} and {@code os} will be the value included
451
+ * in the return. All options from {@code os} will override their counterparts in {@code
452
+ * collection}.
453
+ */
454
+ @ BetaApi
455
+ public static BlobWriteOption [] dedupe (
456
+ Collection <BlobWriteOption > collection , BlobWriteOption ... os ) {
457
+ return Option .dedupe (BlobWriteOption []::new , collection , os );
458
+ }
459
+
460
+ /**
461
+ * Deduplicate any options which are the same parameter.
462
+ *
463
+ * <p>The value which comes last in {@code collection} and {@code os} will be the value included
464
+ * in the return. All options from {@code os} will override their counterparts in {@code
465
+ * collection}.
466
+ */
467
+ @ BetaApi
468
+ public static BlobWriteOption [] dedupe (BlobWriteOption [] array , BlobWriteOption ... os ) {
469
+ return Option .dedupe (BlobWriteOption []::new , array , os );
470
+ }
471
+
369
472
static Storage .BlobWriteOption [] toWriteOptions (BlobInfo blobInfo , BlobWriteOption ... options ) {
370
473
Storage .BlobWriteOption [] convertedOptions = new Storage .BlobWriteOption [options .length ];
371
474
for (int i = 0 ; i < options .length ; i ++) {
0 commit comments