dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22511
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10834: Added missing hashcode/equals methods on SystemSetting
------------------------------------------------------------
revno: 10834
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-05-14 16:29:45 +0200
message:
Added missing hashcode/equals methods on SystemSetting
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSetting.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/setting/SystemSetting.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSetting.java 2012-02-02 20:01:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSetting.java 2013-05-14 14:29:45 +0000
@@ -31,9 +31,9 @@
/**
* @author Stian Strandli
- * @version $Id: SystemSetting.java 3340 2007-06-03 04:01:04Z hanssto $
*/
public class SystemSetting
+ implements Serializable
{
private int id;
@@ -41,16 +41,28 @@
private Serializable value;
+ // -------------------------------------------------------------------------
+ // Constructor
+ // -------------------------------------------------------------------------
+
public SystemSetting()
{
}
-
+
+ // -------------------------------------------------------------------------
+ // Logic
+ // -------------------------------------------------------------------------
+
public boolean hasValue()
{
return value != null;
}
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
public int getId()
{
return id;
@@ -81,4 +93,41 @@
this.value = value;
}
+ // -------------------------------------------------------------------------
+ // hashCode and equals
+ // -------------------------------------------------------------------------
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+
+ if ( o == null )
+ {
+ return false;
+ }
+
+ if ( !(o instanceof SystemSetting) )
+ {
+ return false;
+ }
+
+ final SystemSetting other = (SystemSetting) o;
+
+ return name.equals( other.getName() );
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int prime = 31;
+ int result = 1;
+
+ result = result * prime + name.hashCode();
+
+ return result;
+ }
}