From fa7d7fc0a6cba5a30c727949ab860fefcdc92d82 Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Fri, 25 Sep 2015 21:46:58 +0200 Subject: [PATCH] Minor updates javadoc Blob, Bucket, ListResult --- .../java/com/google/gcloud/storage/Blob.java | 30 ++++++++++--------- .../com/google/gcloud/storage/Bucket.java | 29 +++++++++--------- .../com/google/gcloud/storage/ListResult.java | 4 +-- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java index d3fe181970c8..e0863d23a70c 100644 --- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java +++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java @@ -92,7 +92,7 @@ static Storage.BlobSourceOption[] convert(BlobInfo blobInfo, BlobSourceOption... } /** - * Construct a {@code Blob} object for the provided {@code BlobInfo}. The storage service is used + * Constructs a {@code Blob} object for the provided {@code BlobInfo}. The storage service is used * to issue requests. * * @param storage the storage service used for issuing requests @@ -104,7 +104,7 @@ public Blob(Storage storage, BlobInfo info) { } /** - * Construct a {@code Blob} object for the provided bucket and blob names. The storage service is + * Constructs a {@code Blob} object for the provided bucket and blob names. The storage service is * used to issue requests. * * @param storage the storage service used for issuing requests @@ -117,14 +117,14 @@ public Blob(Storage storage, String bucket, String blob) { } /** - * Return the blob's information. + * Returns the blob's information. */ public BlobInfo info() { return info; } /** - * Check if this blob exists. + * Checks if this blob exists. * * @return true if this blob exists, false otherwise * @throws StorageException upon failure @@ -134,7 +134,7 @@ public boolean exists() { } /** - * Return this blob's content. + * Returns this blob's content. * * @param options blob read options * @throws StorageException upon failure @@ -155,12 +155,12 @@ public Blob reload(BlobSourceOption... options) { } /** - * Update the blob's information. Bucket or blob's name cannot be changed by this method. If you + * Updates the blob's information. Bucket or blob's name cannot be changed by this method. If you * want to rename the blob or move it to a different bucket use the {@link #copyTo} and * {@link #delete} operations. A new {@code Blob} object is returned. By default no checks are * made on the metadata generation of the current blob. If you want to update the information only * if the current blob metadata are at their latest version use the {@code metagenerationMatch} - * option: {@code blob.update(newInfo, BlobTargetOption.metagenerationMatch()}. + * option: {@code blob.update(newInfo, BlobTargetOption.metagenerationMatch())}. * * @param blobInfo new blob's information. Bucket and blob names must match the current ones * @param options update options @@ -174,7 +174,7 @@ public Blob update(BlobInfo blobInfo, BlobTargetOption... options) { } /** - * Delete this blob. + * Deletes this blob. * * @param options blob delete options * @return true if blob was deleted @@ -185,7 +185,8 @@ public boolean delete(BlobSourceOption... options) { } /** - * Copy this blob to the target bucket, preserving its name. Possibly update metadata. + * Copies this blob to the target bucket, preserving its name. Possibly copying also some of the + * metadata (e.g. content-type). * * @param targetBucket target bucket's name * @param options source blob options @@ -197,7 +198,8 @@ public Blob copyTo(String targetBucket, BlobSourceOption... options) { } /** - * Copy this blob to the target bucket with a new name. Possibly update metadata. + * Copies this blob to the target bucket with a new name. Possibly copying also some of the + * metadata (e.g. content-type). * * @param targetBucket target bucket's name * @param targetBlob target blob's name @@ -214,7 +216,7 @@ public Blob copyTo(String targetBucket, String targetBlob, BlobSourceOption... o } /** - * Return a {@code BlobReadChannel} object for reading this blob's content. + * Returns a {@code BlobReadChannel} object for reading this blob's content. * * @param options blob read options * @throws StorageException upon failure @@ -224,7 +226,7 @@ public BlobReadChannel reader(BlobSourceOption... options) { } /** - * Return a {@code BlobWriteChannel} object for writing to this blob. + * Returns a {@code BlobWriteChannel} object for writing to this blob. * * @param options target blob options * @throws StorageException upon failure @@ -234,7 +236,7 @@ public BlobWriteChannel writer(BlobTargetOption... options) { } /** - * Generate a signed URL for this blob. If you want to allow access to for a fixed amount of time + * Generates a signed URL for this blob. If you want to allow access to for a fixed amount of time * for this blob, you can use this method to generate a URL that is only valid within a certain * time period. This is particularly useful if you don't want publicly accessible blobs, but don't * want to require users to explicitly log in. @@ -249,7 +251,7 @@ public URL signUrl(long expirationTimeInSeconds, SignUrlOption... options) { } /** - * Return the blob's {@code Storage} object used to issue requests. + * Returns the blob's {@code Storage} object used to issue requests. */ public Storage storage() { return storage; diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java index b56824f069f6..d7cac447d051 100644 --- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java +++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java @@ -18,14 +18,13 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.gcloud.storage.Blob.BlobSourceOption.convert; import com.google.gcloud.storage.Storage.BlobSourceOption; import com.google.gcloud.storage.Storage.BlobTargetOption; import com.google.gcloud.storage.Storage.BucketSourceOption; import com.google.gcloud.storage.Storage.BucketTargetOption; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -44,7 +43,7 @@ public final class Bucket { private final BucketInfo info; /** - * Construct a {@code Bucket} object for the provided {@code BucketInfo}. The storage service is + * Constructs a {@code Bucket} object for the provided {@code BucketInfo}. The storage service is * used to issue requests. * * @param storage the storage service used for issuing requests @@ -56,7 +55,7 @@ public Bucket(Storage storage, BucketInfo info) { } /** - * Construct a {@code Bucket} object for the provided name. The storage service is used to issue + * Constructs a {@code Bucket} object for the provided name. The storage service is used to issue * requests. * * @param storage the storage service used for issuing requests @@ -68,14 +67,14 @@ public Bucket(Storage storage, String bucket) { } /** - * Return the bucket's information. + * Returns the bucket's information. */ public BucketInfo info() { return info; } /** - * Check if this bucket exists. + * Checks if this bucket exists. * * @return true if this bucket exists, false otherwise * @throws StorageException upon failure @@ -96,11 +95,11 @@ public Bucket reload(BucketSourceOption... options) { } /** - * Update the bucket's information. Bucket's name cannot be changed. A new {@code Bucket} object + * Updates the bucket's information. Bucket's name cannot be changed. A new {@code Bucket} object * is returned. By default no checks are made on the metadata generation of the current bucket. * If you want to update the information only if the current bucket metadata are at their latest * version use the {@code metagenerationMatch} option: - * {@code bucket.update(newInfo, BucketTargetOption.metagenerationMatch());} + * {@code bucket.update(newInfo, BucketTargetOption.metagenerationMatch())} * * @param bucketInfo new bucket's information. Name must match the one of the current bucket * @param options update options @@ -113,7 +112,7 @@ public Bucket update(BucketInfo bucketInfo, BucketTargetOption... options) { } /** - * Delete this bucket. + * Deletes this bucket. * * @param options bucket delete options * @return true if bucket was deleted @@ -124,7 +123,7 @@ public boolean delete(BucketSourceOption... options) { } /** - * Return the paginated list of {@code Blob} in this bucket. + * Returns the paginated list of {@code Blob} in this bucket. * * @param options options for listing blobs * @throws StorageException upon failure @@ -134,7 +133,7 @@ public ListResult list(Storage.BlobListOption... options) { } /** - * Return the requested blob in this bucket or {@code null} if not found. + * Returns the requested blob in this bucket or {@code null} if not found. * * @param blob name of the requested blob * @param options blob search options @@ -145,7 +144,7 @@ public Blob get(String blob, BlobSourceOption... options) { } /** - * Return a list of requested blobs in this bucket. Blobs that do not exist are null. + * Returns a list of requested blobs in this bucket. Blobs that do not exist are null. * * @param blobNames names of the requested blobs * @throws StorageException upon failure @@ -155,7 +154,7 @@ public List getAll(String... blobNames) { for (String blobName : blobNames) { batch.get(info.name(), blobName); } - List blobs = new LinkedList<>(); + List blobs = new ArrayList<>(blobNames.length); BatchResponse response = storage.apply(batch.build()); for (BatchResponse.Result result : response.gets()) { BlobInfo blobInfo = result.get(); @@ -165,7 +164,7 @@ public List getAll(String... blobNames) { } /** - * Create a new blob in this bucket. + * Creates a new blob in this bucket. * * @param blob a blob name * @param content the blob content @@ -179,7 +178,7 @@ Blob create(String blob, byte[] content, BlobTargetOption... options) { } /** - * Return the bucket's {@code Storage} object used to issue requests. + * Returns the bucket's {@code Storage} object used to issue requests. */ public Storage storage() { return storage; diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/ListResult.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/ListResult.java index a07d6edff745..62b1f442310c 100644 --- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/ListResult.java +++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/ListResult.java @@ -22,12 +22,12 @@ public interface ListResult extends Iterable { /** - * Return the cursor for the nextPage or {@code null} if no more results. + * Returns the cursor for the nextPage or {@code null} if no more results. */ String nextPageCursor(); /** - * Return the results of the nextPage or {@code null} if no more result. + * Returns the results of the nextPage or {@code null} if no more result. */ ListResult nextPage();