@@ -61,21 +61,16 @@ protected String value() {
6161 }
6262
6363 @ Override
64- public boolean equals (Object o ) {
65- if (this == o ) {
66- return true ;
67- }
68- if (o == null || getClass () != o .getClass ()) {
69- return false ;
70- }
71- Entity entity = (Entity ) o ;
72- return Objects .equals (type , entity .type ) &&
73- Objects .equals (value , entity .value );
64+ public int hashCode () {
65+ return Objects .hash (type , value );
7466 }
7567
7668 @ Override
77- public int hashCode () {
78- return Objects .hash (type , value );
69+ public boolean equals (Object obj ) {
70+ if (obj == null || !getClass ().isAssignableFrom (obj .getClass ())) {
71+ return false ;
72+ }
73+ return Objects .equals (toPb (), ((Entity )obj ).toPb ());
7974 }
8075
8176 @ Override
@@ -100,9 +95,6 @@ static Entity fromPb(String entity) {
10095 if (entity .startsWith ("group-" )) {
10196 return new Group (entity .substring (6 ));
10297 }
103- if (entity .startsWith ("domain-" )) {
104- return new Domain (entity .substring (7 ));
105- }
10698 if (entity .startsWith ("project-" )) {
10799 int idx = entity .indexOf ('-' , 8 );
108100 String team = entity .substring (8 , idx );
@@ -186,7 +178,7 @@ enum ProjectRole {
186178 OWNERS , EDITORS , VIEWERS
187179 }
188180
189- public Project (ProjectRole pRole , String projectId ) {
181+ Project (ProjectRole pRole , String projectId ) {
190182 super (Type .PROJECT , pRole .name ().toLowerCase () + "-" + projectId );
191183 this .pRole = pRole ;
192184 this .projectId = projectId ;
@@ -228,24 +220,6 @@ public Role role() {
228220 return role ;
229221 }
230222
231- @ Override
232- public int hashCode () {
233- return Objects .hash (entity , role );
234- }
235-
236- @ Override
237- public boolean equals (Object obj ) {
238- if (this == obj ) {
239- return true ;
240- }
241- if (obj == null || getClass () != obj .getClass ()) {
242- return false ;
243- }
244- final Acl other = (Acl ) obj ;
245- return Objects .equals (this .entity , other .entity )
246- && Objects .equals (this .role , other .role );
247- }
248-
249223 BucketAccessControl toBucketPb () {
250224 BucketAccessControl bucketPb = new BucketAccessControl ();
251225 bucketPb .setRole (role ().toString ());
0 commit comments