Implementing equals and hashcode methods for the Asset class

This commit is contained in:
Nelson R. Perez 2016-12-26 21:53:35 -05:00
parent c6e30d0023
commit 01766c856a

View file

@ -15,7 +15,7 @@ public class Asset extends GrapheneObject {
public static final String KEY_DYNAMIC_ASSET_DATA_ID = "dynamic_asset_data_id"; public static final String KEY_DYNAMIC_ASSET_DATA_ID = "dynamic_asset_data_id";
private String symbol; private String symbol;
private int precision; private int precision = -1;
private String issuer; private String issuer;
private String description; private String description;
private String dynamic_asset_data_id; private String dynamic_asset_data_id;
@ -83,6 +83,20 @@ public class Asset extends GrapheneObject {
return description; return description;
} }
@Override
public int hashCode() {
return super.hashCode();
}
@Override
public boolean equals(Object other) {
if(other instanceof Asset){
return this.getObjectId().equals(((Asset)other).getObjectId());
}else{
return false;
}
}
/** /**
* Custom deserializer used to instantiate a simple version of the Asset class from the response of the * Custom deserializer used to instantiate a simple version of the Asset class from the response of the
* 'lookup_asset_symbols' API call. * 'lookup_asset_symbols' API call.