Implementing equals and hashcode methods for the Asset class
This commit is contained in:
parent
c6e30d0023
commit
01766c856a
1 changed files with 15 additions and 1 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue