Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
CFID-290: Add equals and hashcode to UaaPrincipal
Browse files Browse the repository at this point in the history
Change-Id: Ibcecae9216c783cc1856b01089b4c29bb9f3f4de
  • Loading branch information
tekul committed May 15, 2012
1 parent 24bd324 commit 03cbc25
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,27 @@ public String getEmail() {
return email;
}

/**
* Returns {@code true} if the supplied object is a {@code UAAPrincipal} instance with the
* same {@code id} value.
* <p>
* In other words, the objects are equal if they have the same user id, representing the
* same principal.
*/
@Override
public boolean equals(Object rhs) {
if (rhs instanceof UaaPrincipal) {
return id.equals(((UaaPrincipal) rhs).id);
}
return false;
}

/**
* Returns the hashcode of the {@code id}.
*/
@Override
public int hashCode() {
return id.hashCode();
}

}

0 comments on commit 03cbc25

Please sign in to comment.