diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Acl.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Acl.java
index 3d9731352400..fd75e10d92fa 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Acl.java
+++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Acl.java
@@ -23,7 +23,10 @@
import java.util.Objects;
/**
- * Access Control List on for buckets or blobs.
+ * Access Control List for buckets or blobs.
+ *
+ * @see
+ * About Access Control Lists
*/
public final class Acl implements Serializable {
@@ -36,6 +39,9 @@ public enum Role {
OWNER, READER, WRITER
}
+ /**
+ * Base class for Access Control List entities.
+ */
public abstract static class Entity implements Serializable {
private static final long serialVersionUID = -2707407252771255840L;
@@ -52,10 +58,16 @@ public enum Type {
this.value = value;
}
+ /**
+ * Returns the type of entity.
+ */
public Type type() {
return type;
}
+ /**
+ * Returns the entity's value.
+ */
protected String value() {
return value;
}
@@ -112,42 +124,75 @@ static Entity fromPb(String entity) {
}
}
+ /**
+ * Class for ACL Domain entities.
+ */
public static final class Domain extends Entity {
private static final long serialVersionUID = -3033025857280447253L;
+ /**
+ * Creates a domain entity.
+ *
+ * @param domain the domain associated to this entity
+ */
public Domain(String domain) {
super(Type.DOMAIN, domain);
}
+ /**
+ * Returns the domain associated to this entity.
+ */
public String domain() {
return value();
}
}
+ /**
+ * Class for ACL Group entities.
+ */
public static final class Group extends Entity {
private static final long serialVersionUID = -1660987136294408826L;
+ /**
+ * Creates a group entity.
+ *
+ * @param email the group email
+ */
public Group(String email) {
super(Type.GROUP, email);
}
+ /**
+ * Returns the group email.
+ */
public String email() {
return value();
}
}
+ /**
+ * Class for ACL User entities.
+ */
public static final class User extends Entity {
private static final long serialVersionUID = 3076518036392737008L;
private static final String ALL_USERS = "allUsers";
private static final String ALL_AUTHENTICATED_USERS = "allAuthenticatedUsers";
+ /**
+ * Creates a user entity.
+ *
+ * @param email the user email
+ */
public User(String email) {
super(Type.USER, email);
}
+ /**
+ * Returns the user email.
+ */
public String email() {
return value();
}
@@ -174,6 +219,9 @@ public static User ofAllAuthenticatedUsers() {
}
}
+ /**
+ * Class for ACL Project entities.
+ */
public static final class Project extends Entity {
private static final long serialVersionUID = 7933776866530023027L;
@@ -185,16 +233,28 @@ public enum ProjectRole {
OWNERS, EDITORS, VIEWERS
}
+ /**
+ * Creates a project entity.
+ *
+ * @param pRole a role in the project, used to select project's teams
+ * @param projectId id of the project
+ */
public Project(ProjectRole pRole, String projectId) {
super(Type.PROJECT, pRole.name().toLowerCase() + "-" + projectId);
this.pRole = pRole;
this.projectId = projectId;
}
+ /**
+ * Returns the role in the project for this entity.
+ */
public ProjectRole projectRole() {
return pRole;
}
+ /**
+ * Returns the project id for this entity.
+ */
public String projectId() {
return projectId;
}
@@ -214,15 +274,27 @@ String toPb() {
}
}
+ /**
+ * Creats an ACL object.
+ *
+ * @param entity the entity for this ACL object
+ * @param role the role to associate to the {@code entity} object
+ */
public Acl(Entity entity, Role role) {
this.entity = entity;
this.role = role;
}
+ /**
+ * Returns the entity for this ACL object.
+ */
public Entity entity() {
return entity;
}
+ /**
+ * Returns the role associated to the entity in this ACL object.
+ */
public Role role() {
return role;
}
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 d35fcef026c8..a8e315be0e45 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
@@ -50,6 +50,9 @@ public final class Blob {
private final Storage storage;
private final BlobInfo info;
+ /**
+ * Class for specifying blob source options when {@code Blob} methods are used.
+ */
public static class BlobSourceOption extends Option {
private static final long serialVersionUID = 214616862061934846L;
@@ -88,18 +91,34 @@ private Storage.BlobGetOption toGetOption(BlobInfo blobInfo) {
}
}
+ /**
+ * Returns an option for blob's generation match. If this option is used the request will fail
+ * if generation does not match.
+ */
public static BlobSourceOption generationMatch() {
return new BlobSourceOption(StorageRpc.Option.IF_GENERATION_MATCH);
}
+ /**
+ * Returns an option for blob's generation mismatch. If this option is used the request will
+ * fail if generation matches.
+ */
public static BlobSourceOption generationNotMatch() {
return new BlobSourceOption(StorageRpc.Option.IF_GENERATION_NOT_MATCH);
}
+ /**
+ * Returns an option for blob's metageneration match. If this option is used the request will
+ * fail if metageneration does not match.
+ */
public static BlobSourceOption metagenerationMatch() {
return new BlobSourceOption(StorageRpc.Option.IF_METAGENERATION_MATCH);
}
+ /**
+ * Returns an option for blob's metageneration mismatch. If this option is used the request will
+ * fail if metageneration matches.
+ */
public static BlobSourceOption metagenerationNotMatch() {
return new BlobSourceOption(StorageRpc.Option.IF_METAGENERATION_NOT_MATCH);
}
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobId.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobId.java
index eafebe09a4cb..d1209826cc3e 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobId.java
+++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobId.java
@@ -38,10 +38,16 @@ private BlobId(String bucket, String name) {
this.name = name;
}
+ /**
+ * Returns the name of the bucket containing the blob.
+ */
public String bucket() {
return bucket;
}
+ /**
+ * Returns the name of the blob.
+ */
public String name() {
return name;
}
@@ -72,6 +78,12 @@ StorageObject toPb() {
return storageObject;
}
+ /**
+ * Creates a blob identifier.
+ *
+ * @param bucket the name of the bucket that contains the blob
+ * @param name the name of the blob
+ */
public static BlobId of(String bucket, String name) {
return new BlobId(checkNotNull(bucket), checkNotNull(name));
}
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobInfo.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobInfo.java
index 01711a53613e..65b87498b6cc 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobInfo.java
+++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobInfo.java
@@ -123,6 +123,9 @@ public static final class Builder {
private Builder() {}
+ /**
+ * Sets the blob identity.
+ */
public Builder blobId(BlobId blobId) {
this.blobId = checkNotNull(blobId);
return this;
@@ -133,21 +136,41 @@ Builder id(String id) {
return this;
}
+ /**
+ * Sets the blob's data content type.
+ *
+ * @see Content-Type
+ */
public Builder contentType(String contentType) {
this.contentType = firstNonNull(contentType, Data.nullOf(String.class));
return this;
}
+ /**
+ * Sets the blob's data content disposition.
+ *
+ * @see Content-Disposition
+ */
public Builder contentDisposition(String contentDisposition) {
this.contentDisposition = firstNonNull(contentDisposition, Data.nullOf(String.class));
return this;
}
+ /**
+ * Sets the blob's data content language.
+ *
+ * @see Content-Language
+ */
public Builder contentLanguage(String contentLanguage) {
this.contentLanguage = firstNonNull(contentLanguage, Data.nullOf(String.class));
return this;
}
+ /**
+ * Sets the blob's data content encoding.
+ *
+ * @see Content-Encoding
+ */
public Builder contentEncoding(String contentEncoding) {
this.contentEncoding = firstNonNull(contentEncoding, Data.nullOf(String.class));
return this;
@@ -158,11 +181,22 @@ Builder componentCount(Integer componentCount) {
return this;
}
+ /**
+ * Sets the blob's data cache control.
+ *
+ * @see Cache-Control
+ */
public Builder cacheControl(String cacheControl) {
this.cacheControl = firstNonNull(cacheControl, Data.nullOf(String.class));
return this;
}
+ /**
+ * Sets the blob's access control configuration.
+ *
+ * @see
+ * About Access Control Lists
+ */
public Builder acl(List acl) {
this.acl = acl != null ? ImmutableList.copyOf(acl) : null;
return this;
@@ -188,11 +222,25 @@ Builder selfLink(String selfLink) {
return this;
}
+ /**
+ * Sets the MD5 hash of blob's data. MD5 value must be encoded in base64.
+ *
+ * @see
+ * Hashes and ETags: Best Practices
+ */
public Builder md5(String md5) {
this.md5 = firstNonNull(md5, Data.nullOf(String.class));
return this;
}
+ /**
+ * Sets the CRC32C checksum of blob's data as described in
+ * RFC 4960, Appendix B; encoded in
+ * base64 in big-endian order.
+ *
+ * @see
+ * Hashes and ETags: Best Practices
+ */
public Builder crc32c(String crc32c) {
this.crc32c = firstNonNull(crc32c, Data.nullOf(String.class));
return this;
@@ -203,6 +251,9 @@ Builder mediaLink(String mediaLink) {
return this;
}
+ /**
+ * Sets the blob's user provided metadata.
+ */
public Builder metadata(Map metadata) {
this.metadata = metadata != null
? new HashMap(metadata) : Data.