Define ContactResource equality based on resourceName. (fixes OTR issue)

New ContactResource instances will be created after recovering from network
connectivity loss. (Initiated by suspending the system.) UI behaviour
fails because ContactResource instances themselves do not have the same
reference address and no custom equality was defined.
maven
Danny van Heumen 11 years ago
parent d09a39f8f4
commit efa649ad77

@ -125,4 +125,35 @@ public boolean isMobile()
{
return mobile;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result =
prime * result
+ ((resourceName == null) ? 0 : resourceName.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ContactResource other = (ContactResource) obj;
if (resourceName == null)
{
if (other.resourceName != null)
return false;
}
else if (!resourceName.equals(other.resourceName))
return false;
return true;
}
}

Loading…
Cancel
Save