Adding URL based equals and hashcode to BaseResourceBean.

This commit is contained in:
bdc34 2010-03-23 21:58:18 +00:00
parent dd84a0ddf4
commit 7731df5235

View file

@ -207,4 +207,27 @@ public class BaseResourceBean implements ResourceBean {
}
*/
@Override
public boolean equals(Object obj) {
if(obj == null )
return false;
else if (obj instanceof BaseResourceBean ){
String thisURI = this.getURI();
String thatURI = ((BaseResourceBean)obj).getURI();
if( thisURI != null && thatURI != null ){
return thisURI.equals(thatURI);
}
}
return obj.hashCode() == this.hashCode();
}
@Override
public int hashCode() {
if( getURI() != null )
return getURI().hashCode();
else
return super.hashCode();
}
}