Implementing equals and hashcode methods for the Asset class

master
Nelson R. Perez 2016-12-26 21:53:35 -05:00
parent c6e30d0023
commit 01766c856a
1 changed files with 15 additions and 1 deletions

View File

@ -15,7 +15,7 @@ public class Asset extends GrapheneObject {
public static final String KEY_DYNAMIC_ASSET_DATA_ID = "dynamic_asset_data_id";
private String symbol;
private int precision;
private int precision = -1;
private String issuer;
private String description;
private String dynamic_asset_data_id;
@ -83,6 +83,20 @@ public class Asset extends GrapheneObject {
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
* 'lookup_asset_symbols' API call.