add clone checks

This commit is contained in:
danikov 2012-02-29 11:29:50 +00:00
parent a307c44a22
commit ed6cfca0a7
4 changed files with 42 additions and 0 deletions

View File

@ -199,6 +199,18 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
equal(this.tasksInProgress, that.tasksInProgress) && equal(this.name, that.name);
}
@Override
public boolean clone(Object o) {
if (this == o)
return false;
if (o == null || getClass() != o.getClass())
return false;
EntityType<?> that = EntityType.class.cast(o);
return super.equals(that) &&
equal(this.description, that.description) &&
equal(this.name, that.name);
}
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(description, tasksInProgress, id, name);

View File

@ -245,6 +245,17 @@ public class Media extends ResourceEntityType<Media> {
equal(this.owner, that.owner) && equal(this.imageType, that.imageType) && equal(this.size, that.size);
}
@Override
public boolean clone(Object o) {
if (this == o)
return false;
if (o == null || getClass() != o.getClass())
return false;
Media that = Media.class.cast(o);
return super.clone(that) &&
equal(this.owner, that.owner) && equal(this.imageType, that.imageType) && equal(this.size, that.size);
}
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(owner, imageType, size);

View File

@ -168,6 +168,16 @@ public abstract class ResourceEntityType<T extends ResourceEntityType<T>> extend
return super.equals(that) && equal(this.files, that.files) && equal(this.status, that.status);
}
@Override
public boolean clone(Object o) {
if (this == o)
return false;
if (o == null || getClass() != o.getClass())
return false;
ResourceEntityType<?> that = ResourceEntityType.class.cast(o);
return super.clone(that) && equal(this.files, that.files);
}
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(files, status);

View File

@ -161,6 +161,15 @@ public abstract class ResourceType<T extends ResourceType<T>> implements URISupp
return equal(this.href, that.href) && equal(this.links, that.links) && equal(this.type, that.type);
}
public boolean clone(Object o) {
if (this == o)
return false;
if (o == null || getClass() != o.getClass())
return false;
ResourceType<?> that = ResourceType.class.cast(o);
return equal(this.type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(href, links, type);