dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24524
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12037: BaseIdentifiableObject, made equals and hashcode consistent
------------------------------------------------------------
revno: 12037
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-09-11 15:02:54 +0200
message:
BaseIdentifiableObject, made equals and hashcode consistent
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2013-09-09 12:47:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2013-09-11 13:02:54 +0000
@@ -339,13 +339,11 @@
int result = uid != null ? uid.hashCode() : 0;
result = 31 * result + (code != null ? code.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
- result = 31 * result + (lastUpdated != null ? lastUpdated.hashCode() : 0);
- result = 31 * result + (created != null ? created.hashCode() : 0);
return result;
}
- @Override
+ @Override
public boolean equals( Object o )
{
if ( this == o )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2013-09-11 13:02:54 +0000
@@ -94,13 +94,22 @@
}
@Override
+ public int hashCode()
+ {
+ int result = super.hashCode();
+ result = 31 * result + (shortName != null ? shortName.hashCode() : 0);
+ result = 31 * result + (description != null ? description.hashCode() : 0);
+ return result;
+ }
+
+ @Override
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
-
+
if ( o == null || getClass() != o.getClass() )
{
return false;
@@ -113,21 +122,19 @@
BaseNameableObject that = (BaseNameableObject) o;
- if ( description != null ? !description.equals( that.description ) : that.description != null ) return false;
- if ( shortName != null ? !shortName.equals( that.shortName ) : that.shortName != null ) return false;
+ if ( shortName != null ? !shortName.equals( that.shortName ) : that.shortName != null )
+ {
+ return false;
+ }
+
+ if ( description != null ? !description.equals( that.description ) : that.description != null )
+ {
+ return false;
+ }
return true;
}
- @Override
- public int hashCode()
- {
- int result = super.hashCode();
- result = 31 * result + (shortName != null ? shortName.hashCode() : 0);
- result = 31 * result + (description != null ? description.hashCode() : 0);
- return result;
- }
-
@JsonProperty
@JsonView({ ShortNameView.class, DetailedView.class, ExportView.class })
@JacksonXmlProperty(isAttribute = true)