Author: glandais Date: 2008-03-20 16:36:31 +0000 (Thu, 20 Mar 2008) New Revision: 1421 Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java Log: hashCode and equals for tests Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-03-20 14:34:47 UTC (rev 1420) +++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-03-20 16:36:31 UTC (rev 1421) @@ -315,4 +315,86 @@ return getEntityType().getLibelle(); } + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((elementClass == null) ? 0 : elementClass.hashCode()); + result = prime * result + ((hash == null) ? 0 : hash.hashCode()); + result = prime * result + (latest ? 1231 : 1237); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((parentUuid == null) ? 0 : parentUuid.hashCode()); + result = prime * result + ((parentVersion == null) ? 0 : parentVersion.hashCode()); + result = prime * result + ((uuid == null) ? 0 : uuid.hashCode()); + result = prime * result + ((version == null) ? 0 : version.hashCode()); + return result; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final MetaData other = (MetaData) obj; + if (creationDate == null) { + if (other.creationDate != null) + return false; + } else if (!creationDate.equals(other.creationDate)) + return false; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (elementClass == null) { + if (other.elementClass != null) + return false; + } else if (!elementClass.equals(other.elementClass)) + return false; + if (hash == null) { + if (other.hash != null) + return false; + } else if (!hash.equals(other.hash)) + return false; + if (latest != other.latest) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + if (parentUuid == null) { + if (other.parentUuid != null) + return false; + } else if (!parentUuid.equals(other.parentUuid)) + return false; + if (parentVersion == null) { + if (other.parentVersion != null) + return false; + } else if (!parentVersion.equals(other.parentVersion)) + return false; + if (uuid == null) { + if (other.uuid != null) + return false; + } else if (!uuid.equals(other.uuid)) + return false; + if (version == null) { + if (other.version != null) + return false; + } else if (!version.equals(other.version)) + return false; + return true; + } + } \ No newline at end of file
participants (1)
-
glandais@users.labs.libre-entreprise.org