mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-6089: Implement equals() method for ResourceTagResponse
so that the java Set can properly determine if a ResourceTagResponse is unique. This ensures we don't get duplicate resource tags showing up any time a UserVmResponse is crafted (which can be quite often due to the way the responses are crafted).
This commit is contained in:
parent
9f597ef130
commit
d33798f0d9
@ -109,4 +109,34 @@ public class ResourceTagResponse extends BaseResponse implements ControlledViewE
|
||||
public void setCustomer(String customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public String getResourceId() {
|
||||
return this.resourceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
String rId = this.getResourceId();
|
||||
result = prime * result + ((rId== null) ? 0 : rId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (this.getClass() != obj.getClass())
|
||||
return false;
|
||||
ResourceTagResponse other = (ResourceTagResponse) obj;
|
||||
String rId = this.getResourceId();
|
||||
if (rId == null && other.getResourceId() != null) {
|
||||
return false;
|
||||
} else if (!rId.equals(other.getResourceId()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user