Small improvements to Assets and UserAccount classes

This commit is contained in:
Nelson R. Perez 2017-01-18 22:30:04 -05:00
parent 9c5d2e1be0
commit a9b99d88a1
2 changed files with 12 additions and 1 deletions

View file

@ -137,7 +137,7 @@ public class Asset extends GrapheneObject {
@Override
public int hashCode() {
return super.hashCode();
return this.getObjectId() == null ? 0 : this.getObjectId().hashCode();
}
@Override

View file

@ -48,6 +48,7 @@ public class UserAccount extends GrapheneObject implements ByteSerializable, Jso
return accountName;
}
/**
* Setter for the account name field.
* @param accountName: The account name.
@ -56,6 +57,16 @@ public class UserAccount extends GrapheneObject implements ByteSerializable, Jso
this.accountName = accountName;
}
@Override
public boolean equals(Object o) {
return this.getObjectId().equals(((UserAccount)o).getObjectId());
}
@Override
public int hashCode() {
return this.getObjectId().hashCode();
}
@Override
public byte[] toBytes() {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();