View Javadoc

1   /*
2    * Created on 21 Mar 2009
3    *
4    */
5   package org.sourceforge.jemm.database;
6   
7   
8   /**
9    * The ClientId represents a client to a database instance.
10   * @author Rory Graves
11   */
12  public class ClientId {
13      protected final String clientId;
14      
15      /**
16       * @param internalId
17       */
18      public ClientId(String internalId) {
19          if(internalId == null)
20              throw new IllegalArgumentException("client internal id may not be null");
21          
22          this.clientId = internalId;
23      }
24  
25      @Override
26      public String toString() {
27          return "ClientId(" + clientId + ")";
28      }
29  
30      @Override
31      public int hashCode() {
32          return clientId.hashCode();
33      }
34  
35      @Override
36      public boolean equals(Object obj) {
37          if (this == obj)
38              return true;
39          if (obj == null)
40              return false;
41          if (getClass() != obj.getClass())
42              return false;
43          ClientId other = (ClientId) obj;
44          return clientId.equals(other.clientId);
45      }
46      
47      public String getInternalRep() {
48      	return clientId;
49      }
50  }