Skip to content

Commit 703c476

Browse files
committed
---
yaml --- r: 6361 b: refs/heads/tswast-patch-1 c: 3b91741 h: refs/heads/master i: 6359: a976de0
1 parent e85e800 commit 703c476

3 files changed

Lines changed: 40 additions & 10 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: 333a3bb13bdf1714e43aea78085fcb29d8488dd9
60+
refs/heads/tswast-patch-1: 3b917417d6ca9b0cee5a162955755d8a35d1aaa0
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,16 @@ public Blob reload(BlobSourceOption... options) {
190190
* made on the metadata generation of the current blob. If you want to update the information only
191191
* if the current blob metadata are at their latest version use the {@code metagenerationMatch}
192192
* option: {@code blob.update(newInfo, BlobTargetOption.metagenerationMatch())}.
193+
* <p>
194+
* Original metadata are merged with metadata in the provided {@code blobInfo}. To replace
195+
* metadata instead you first have to unset them. Unsetting metadata can be done by setting the
196+
* provided {@code blobInfo}'s metadata to {@code null}.
197+
* </p>
198+
* <p>
199+
* Example usage of replacing blob's metadata:
200+
* <pre> {@code blob.update(blob.info().toBuilder().metadata(null).build());}
201+
* {@code blob.update(blob.info().toBuilder().metadata(newMetadata).build());}
202+
* </pre>
193203
*
194204
* @param blobInfo new blob's information. Bucket and blob names must match the current ones
195205
* @param options update options
@@ -306,8 +316,7 @@ public Storage storage() {
306316
}
307317

308318
/**
309-
* Gets the requested blobs. If {@code infos.length == 0} an empty list is returned. If
310-
* {@code infos.length > 1} a batch request is used to fetch blobs.
319+
* Gets the requested blobs. A batch request is used to fetch blobs.
311320
*
312321
* @param storage the storage service used to issue the request
313322
* @param blobs the blobs to get
@@ -331,8 +340,12 @@ public Blob apply(BlobInfo f) {
331340
}
332341

333342
/**
334-
* Updates the requested blobs. If {@code infos.length == 0} an empty list is returned. If
335-
* {@code infos.length > 1} a batch request is used to update blobs.
343+
* Updates the requested blobs. A batch request is used to update blobs. Original metadata are
344+
* merged with metadata in the provided {@code BlobInfo} objects. To replace metadata instead
345+
* you first have to unset them. Unsetting metadata can be done by setting the provided
346+
* {@code BlobInfo} objects metadata to {@code null}. See
347+
* {@link #update(com.google.gcloud.storage.BlobInfo,
348+
* com.google.gcloud.storage.Storage.BlobTargetOption...) } for a code example.
336349
*
337350
* @param storage the storage service used to issue the request
338351
* @param infos the blobs to update
@@ -356,8 +369,7 @@ public Blob apply(BlobInfo f) {
356369
}
357370

358371
/**
359-
* Deletes the requested blobs. If {@code infos.length == 0} an empty list is returned. If
360-
* {@code infos.length > 1} a batch request is used to delete blobs.
372+
* Deletes the requested blobs. A batch request is used to delete blobs.
361373
*
362374
* @param storage the storage service used to issue the request
363375
* @param blobs the blobs to delete

branches/tswast-patch-1/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -683,15 +683,29 @@ public static Builder builder() {
683683
BucketInfo update(BucketInfo bucketInfo, BucketTargetOption... options);
684684

685685
/**
686-
* Update blob information.
686+
* Update blob information. Original metadata are merged with metadata in the provided
687+
* {@code blobInfo}. To replace metadata instead you first have to unset them. Unsetting metadata
688+
* can be done by setting the provided {@code blobInfo}'s metadata to {@code null}.
689+
* <p>
690+
* Example usage of replacing blob's metadata:
691+
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
692+
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
693+
* </pre>
687694
*
688695
* @return the updated blob
689696
* @throws StorageException upon failure
690697
*/
691698
BlobInfo update(BlobInfo blobInfo, BlobTargetOption... options);
692699

693700
/**
694-
* Update blob information.
701+
* Update blob information. Original metadata are merged with metadata in the provided
702+
* {@code blobInfo}. To replace metadata instead you first have to unset them. Unsetting metadata
703+
* can be done by setting the provided {@code blobInfo}'s metadata to {@code null}.
704+
* <p>
705+
* Example usage of replacing blob's metadata:
706+
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
707+
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
708+
* </pre>
695709
*
696710
* @return the updated blob
697711
* @throws StorageException upon failure
@@ -826,7 +840,11 @@ public static Builder builder() {
826840
List<BlobInfo> get(BlobId... blobIds);
827841

828842
/**
829-
* Updates the requested blobs. A batch request is used to perform this call.
843+
* Updates the requested blobs. A batch request is used to perform this call. Original metadata
844+
* are merged with metadata in the provided {@code BlobInfo} objects. To replace metadata instead
845+
* you first have to unset them. Unsetting metadata can be done by setting the provided
846+
* {@code BlobInfo} objects metadata to {@code null}. See
847+
* {@link #update(com.google.gcloud.storage.BlobInfo)} for a code example.
830848
*
831849
* @param blobInfos blobs to update
832850
* @return an immutable list of {@code BlobInfo} objects. If a blob does not exist or access to it

0 commit comments

Comments
 (0)