fix toString, equals and hashcode,

This commit is contained in:
danikov 2012-02-29 11:30:51 +00:00
parent cdf2ddb0ac
commit 5003f7adb3
1 changed files with 8 additions and 5 deletions

View File

@ -31,6 +31,7 @@ import javax.xml.bind.annotation.adapters.NormalizedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -228,24 +229,26 @@ public class File extends EntityType<File> {
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
File that = File.class.cast(o); File that = File.class.cast(o);
return equal(size, that.size) && return super.equals(that) &&
equal(size, that.size) &&
equal(bytesTransferred, that.bytesTransferred) && equal(bytesTransferred, that.bytesTransferred) &&
equal(checksum, that.checksum); equal(checksum, that.checksum);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(size, return Objects.hashCode(super.hashCode(),
size,
bytesTransferred, bytesTransferred,
checksum); checksum);
} }
@Override @Override
public String toString() { public ToStringHelper string() {
return Objects.toStringHelper("") return super.string()
.add("size", size) .add("size", size)
.add("bytesTransferred", bytesTransferred) .add("bytesTransferred", bytesTransferred)
.add("checksum", checksum).toString(); .add("checksum", checksum);
} }
} }