View Javadoc

1   package net.ramapuram.thomas.model;
2   
3   import java.io.Serializable;
4   
5   
6   /**
7    * Base class for Model objects. Child objects should implement toString(),
8    * equals() and hashCode().
9    * 
10   * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
11   */
12  public abstract class BaseObject implements Serializable {    
13  
14      /**
15       * Returns a multi-line String with key=value pairs.
16       * @return a String representation of this class.
17       */
18      public abstract String toString();
19  
20      /**
21       * Compares object equality. When using Hibernate, the primary key should
22       * not be a part of this comparison.
23       * @param o object to compare to
24       * @return true/false based on equality tests
25       */
26      public abstract boolean equals(Object o);
27  
28      /**
29       * When you override equals, you should override hashCode. See "Why are
30       * equals() and hashCode() importation" for more information:
31       * http://www.hibernate.org/109.html
32       * @return hashCode
33       */
34      public abstract int hashCode();
35  }