You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ad...@apache.org on 2004/06/13 18:52:53 UTC
cvs commit: incubator-geronimo/modules/security/src/java/org/apache/geronimo/security PrimaryRealmPrincipal.java
adc 2004/06/13 09:52:53
Modified: modules/security/src/java/org/apache/geronimo/security
PrimaryRealmPrincipal.java
Log:
Should implement its own equals() method.
Revision Changes Path
1.5 +18 -1 incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/PrimaryRealmPrincipal.java
Index: PrimaryRealmPrincipal.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/PrimaryRealmPrincipal.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PrimaryRealmPrincipal.java 10 Mar 2004 09:59:25 -0000 1.4
+++ PrimaryRealmPrincipal.java 13 Jun 2004 16:52:53 -0000 1.5
@@ -28,4 +28,21 @@
public PrimaryRealmPrincipal(String realm, Principal principal) {
super(realm, principal);
}
+
+ /**
+ * Compares this principal to the specified object. Returns true
+ * if the object passed in matches the principal represented by
+ * the implementation of this interface.
+ *
+ * @param another principal to compare with.
+ * @return true if the principal passed in is the same as that
+ * encapsulated by this principal, and false otherwise.
+ */
+ public boolean equals(Object another) {
+ if (!(another instanceof PrimaryRealmPrincipal)) return false;
+
+ PrimaryRealmPrincipal realmPrincipal = (PrimaryRealmPrincipal) another;
+
+ return getRealm().equals(realmPrincipal.getRealm()) && getPrincipal().equals(realmPrincipal.getPrincipal());
+ }
}