From 6111d08aa255ce1737346afc2e40b8058ad2e13f Mon Sep 17 00:00:00 2001 From: jakubs <jakubs> Date: Mon, 5 Nov 2012 09:24:24 +0000 Subject: [PATCH] SP-295 BIS-190 - add hashcode and equals to objectId classes SVN: 27486 --- .../api/v1/dto/id/dataset/DataSetCodeId.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/id/dataset/DataSetCodeId.java b/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/id/dataset/DataSetCodeId.java index c5a1ff6170f..5a573cb62ea 100644 --- a/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/id/dataset/DataSetCodeId.java +++ b/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/id/dataset/DataSetCodeId.java @@ -69,4 +69,39 @@ public class DataSetCodeId implements IDataSetId return getCode(); } + @Override + public int hashCode() + { + return ((code == null) ? 0 : code.hashCode()); + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + DataSetCodeId other = (DataSetCodeId) obj; + if (code == null) + { + if (other.code != null) + { + return false; + } + } else if (!code.equals(other.code)) + { + return false; + } + return true; + } + } -- GitLab