View Javadoc

1   /*
2    * Created on 21 Mar 2009
3    *
4    */
5   package org.sourceforge.jemm.database;
6   
7   import java.io.Serializable;
8   
9   
10  /**
11   * ClassId represents the id assigned to a class when it has been registered with a database.
12   * 
13   * @author Rory Graves
14   */
15  public class ClassId implements Serializable {
16  	private static final long serialVersionUID = 1L;
17  
18  	/** The internal class id representation */
19      private final long internalClassId;
20      
21      /** Create a ClassId using the given internal value.
22       * @param internalClassId The internal id value.
23       */
24      public ClassId(long internalClassId) {
25          this.internalClassId = internalClassId;
26      }
27      
28      @Override
29      public int hashCode() {
30          return (int) (getInternalClassId() ^ (getInternalClassId() >>> 32));
31      }
32  
33      @Override
34      public boolean equals(Object obj) {
35          if (this == obj) return true;
36          if (obj == null) return false;
37          if (getClass() != obj.getClass()) return false;
38          ClassId other = (ClassId) obj;
39          return getInternalClassId() == other.getInternalClassId();
40      }
41  
42      @Override public String toString() {
43          return "ClassId(" + getInternalClassId() + ")";
44      }
45  
46      /**
47       * Get the internal representation of class id.
48       * @return The internal representation of the class id.
49       */
50  	public long getInternalClassId() {
51  		return internalClassId;
52  	}
53  }