Commit bb783aac authored by Matija Obreza's avatar Matija Obreza

Added equals on VersionedModel

- Pretty print VersionedModel and BasicModel
parent 8dc64050
......@@ -111,4 +111,9 @@ public class BasicModel implements EntityId, Serializable {
}
return true;
}
@Override
public String toString() {
return super.toString() + " id=" + this.id;
}
}
......@@ -86,4 +86,37 @@ public abstract class VersionedModel extends BasicModel implements Activatable {
public void setActive(final boolean active) {
this.active = active;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + (active ? 1231 : 1237);
result = prime * result + ((version == null) ? 0 : version.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
VersionedModel other = (VersionedModel) obj;
if (active != other.active)
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
return true;
}
@Override
public String toString() {
return super.toString() + " version=" + this.version + " active=" + this.active;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment