@@ -370,22 +370,11 @@ Access toPb() {
370370 }
371371 }
372372
373- /**
374- * Build an ACL for an {@code entity} and a {@code role}.
375- */
376- public Acl (Entity entity , Role role ) {
373+ private Acl (Entity entity , Role role ) {
377374 this .entity = checkNotNull (entity );
378375 this .role = role ;
379376 }
380377
381- /**
382- * Build an ACL for a view entity.
383- */
384- public Acl (View view ) {
385- this .entity = checkNotNull (view );
386- this .role = null ;
387- }
388-
389378 /**
390379 * Returns the entity for this ACL.
391380 */
@@ -400,6 +389,23 @@ public Role role() {
400389 return role ;
401390 }
402391
392+ /**
393+ * Returns an Acl object.
394+ *
395+ * @param entity the entity for this ACL object
396+ * @param role the role to associate to the {@code entity} object
397+ */
398+ public static Acl of (Entity entity , Role role ) {
399+ return new Acl (entity , role );
400+ }
401+
402+ /**
403+ * Returns an Acl object for a view entity.
404+ */
405+ public static Acl of (View view ) {
406+ return new Acl (view , null );
407+ }
408+
403409 @ Override
404410 public int hashCode () {
405411 return Objects .hash (entity , role );
@@ -432,7 +438,7 @@ Access toPb() {
432438 }
433439
434440 static Acl fromPb (Access access ) {
435- return new Acl (Entity .fromPb (access ),
441+ return Acl . of (Entity .fromPb (access ),
436442 access .getRole () != null ? Role .valueOf (access .getRole ()) : null );
437443 }
438444}
0 commit comments