java 重新equals和hashcode
参见:spring-plugin-metadata-1.2.0.RELEASE.jar 的SimplePluginMetadata
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof PluginMetadata)) {
return false;
}
PluginMetadata that = (PluginMetadata) obj;
boolean sameName = nullSafeEquals(this.getName(), that.getName());
boolean sameVersion = nullSafeEquals(this.getVersion(), that.getVersion());
return sameName && sameVersion;
}
/*
* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return nullSafeHashCode(name) + nullSafeHashCode(version);
}