Bugzilla – Bug 6209
define equivalence relation on SAMLAttribute
Last modified: 2008-07-07 20:58:55
You need to log in before you can comment on or make changes to this bug.
Define an equivalence relation on the SAMLAttribute type, which allows a developer to use the equals method on two SAMLAttribute instances: import org.globus.opensaml11.saml.SAMLAttribute; ... SAMLAttribute attribute1, attribute2; ... if (attribute1.equals(attribute2)) { ... }
See Bug 4757 for details how this was done for the SAMLNameIdentifier class.
Do attribute values take part in the equivalence relation? protected boolean localEquals(Object obj) { if (this == obj) return true; if (!(obj instanceof SAMLAttribute)) return false; // type checking occurs in the calling method: SAMLAttribute attribute = (SAMLAttribute)obj; if (!XML.safeCompare(attribute.name, this.name) || !XML.safeCompare(attribute.namespace, this.namespace)) { return false; } // do the values play any part in the equivalence relation? return true; }
Added the following method to the SAMLAttribute API: /** * Compares the values of this object with the values of the * given object. This method returns true if and only if * the two objects have the same values. * * @param obj the object whose values will be compared * to the values of this object * @return true if and only if the values associated * with the two objects are equal */ public boolean hasEqualValues(Object obj);
Committed SAMLAttribute.java to CVS HEAD. Keeping this bug until SAMLAttributeTest has been updated and a new globus-opensaml-1.1.jar is uploaded.