2323import java .util .Objects ;
2424
2525/**
26- * Access Control List on for buckets or blobs.
26+ * Access Control List for buckets or blobs.
27+ *
28+ * @see <a href="https://cloud.google.com/storage/docs/access-control#About-Access-Control-Lists">
29+ * About Access Control Lists</a>
2730 */
2831public final class Acl implements Serializable {
2932
@@ -36,6 +39,9 @@ public enum Role {
3639 OWNER , READER , WRITER
3740 }
3841
42+ /**
43+ * Base class for Access Control List entities.
44+ */
3945 public abstract static class Entity implements Serializable {
4046
4147 private static final long serialVersionUID = -2707407252771255840L ;
@@ -52,10 +58,16 @@ public enum Type {
5258 this .value = value ;
5359 }
5460
61+ /**
62+ * Returns the type of entity.
63+ */
5564 public Type type () {
5665 return type ;
5766 }
5867
68+ /**
69+ * Returns the entity's value.
70+ */
5971 protected String value () {
6072 return value ;
6173 }
@@ -112,42 +124,75 @@ static Entity fromPb(String entity) {
112124 }
113125 }
114126
127+ /**
128+ * Class for ACL Domain entities.
129+ */
115130 public static final class Domain extends Entity {
116131
117132 private static final long serialVersionUID = -3033025857280447253L ;
118133
134+ /**
135+ * Creates a domain entity.
136+ *
137+ * @param domain the domain associated to this entity
138+ */
119139 public Domain (String domain ) {
120140 super (Type .DOMAIN , domain );
121141 }
122142
143+ /**
144+ * Returns the domain associated to this entity.
145+ */
123146 public String domain () {
124147 return value ();
125148 }
126149 }
127150
151+ /**
152+ * Class for ACL Group entities.
153+ */
128154 public static final class Group extends Entity {
129155
130156 private static final long serialVersionUID = -1660987136294408826L ;
131157
158+ /**
159+ * Creates a group entity.
160+ *
161+ * @param email the group email
162+ */
132163 public Group (String email ) {
133164 super (Type .GROUP , email );
134165 }
135166
167+ /**
168+ * Returns the group email.
169+ */
136170 public String email () {
137171 return value ();
138172 }
139173 }
140174
175+ /**
176+ * Class for ACL User entities.
177+ */
141178 public static final class User extends Entity {
142179
143180 private static final long serialVersionUID = 3076518036392737008L ;
144181 private static final String ALL_USERS = "allUsers" ;
145182 private static final String ALL_AUTHENTICATED_USERS = "allAuthenticatedUsers" ;
146183
184+ /**
185+ * Creates a user entity.
186+ *
187+ * @param email the user email
188+ */
147189 public User (String email ) {
148190 super (Type .USER , email );
149191 }
150192
193+ /**
194+ * Returns the user email.
195+ */
151196 public String email () {
152197 return value ();
153198 }
@@ -174,6 +219,9 @@ public static User ofAllAuthenticatedUsers() {
174219 }
175220 }
176221
222+ /**
223+ * Class for ACL Project entities.
224+ */
177225 public static final class Project extends Entity {
178226
179227 private static final long serialVersionUID = 7933776866530023027L ;
@@ -185,16 +233,28 @@ public enum ProjectRole {
185233 OWNERS , EDITORS , VIEWERS
186234 }
187235
236+ /**
237+ * Creates a project entity.
238+ *
239+ * @param pRole a role in the project, used to select project's teams
240+ * @param projectId id of the project
241+ */
188242 public Project (ProjectRole pRole , String projectId ) {
189243 super (Type .PROJECT , pRole .name ().toLowerCase () + "-" + projectId );
190244 this .pRole = pRole ;
191245 this .projectId = projectId ;
192246 }
193247
248+ /**
249+ * Returns the role in the project for this entity.
250+ */
194251 public ProjectRole projectRole () {
195252 return pRole ;
196253 }
197254
255+ /**
256+ * Returns the project id for this entity.
257+ */
198258 public String projectId () {
199259 return projectId ;
200260 }
@@ -214,15 +274,27 @@ String toPb() {
214274 }
215275 }
216276
277+ /**
278+ * Creats an ACL object.
279+ *
280+ * @param entity the entity for this ACL object
281+ * @param role the role to associate to the {@code entity} object
282+ */
217283 public Acl (Entity entity , Role role ) {
218284 this .entity = entity ;
219285 this .role = role ;
220286 }
221287
288+ /**
289+ * Returns the entity for this ACL object.
290+ */
222291 public Entity entity () {
223292 return entity ;
224293 }
225294
295+ /**
296+ * Returns the role associated to the entity in this ACL object.
297+ */
226298 public Role role () {
227299 return role ;
228300 }
0 commit comments