*
* @author Dmitry Samoshin aka gotty
*/
-public abstract class DomainObject {
+public abstract class DomainObject<DomainObjectType extends DomainObject> {
- public static final String ID_PROPERTY = "id";
+ public static final String ID_PARAMETER = "id";
+
+ public abstract Long getId();
+
+ public boolean isIdentical(DomainObjectType another) {
+ if (another == null)
+ return false;
+
+ if ((getId() == null) != (another.getId() == null))
+ return false;
+
+ if ((getId() == null) && (another.getId() == null))
+ return true;
+
+ return getId().equals(
+ another.getId()
+ );
+ }
}