View Javadoc

1   /*
2       Copyright (C) 2004 PjEr
3       
4       This program is free software; you can redistribute it and/or modify
5       it under the terms of the GNU General Public License as published by
6       the Free Software Foundation; either version 2 of the License, or
7       (at your option) any later version.
8       
9       This program is distributed in the hope that it will be useful,
10      but WITHOUT ANY WARRANTY; without even the implied warranty of
11      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12      GNU General Public License for more details.
13      
14      You should have received a copy of the GNU General Public License
15      along with this program; if not, write to the Free Software
16      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18  package ca.pjer.cm.module.access.defaultimpl;
19  
20  import ca.pjer.cm.api.access.AccessToken;
21  
22  /***
23   * <br />
24   * $Id: AccessTokenImpl.java,v 1.1 2004/05/19 03:29:17 pjer Exp $<br />
25   * <br />
26   * $RCSfile: AccessTokenImpl.java,v $<br />
27   * $Revision: 1.1 $<br />
28   * $Author: pjer $<br />
29   * $Date: 2004/05/19 03:29:17 $<br />
30   * 
31   * @TODO comment me.<br />
32   */
33  public class AccessTokenImpl implements AccessToken {
34      private Integer userId;
35  
36      public AccessTokenImpl(Integer userId) {
37          this.userId = userId;
38      }
39  
40      public Integer getUserId() {
41          return userId;
42      }
43  
44      public boolean equals(Object o) {
45          if (this == o) return true;
46          if (!(o instanceof AccessTokenImpl)) return false;
47  
48          final AccessTokenImpl accessToken = (AccessTokenImpl) o;
49  
50          if (userId != null ? !userId.equals(accessToken.userId) : accessToken.userId != null) return false;
51  
52          return true;
53      }
54  
55      public int hashCode() {
56          return (userId != null ? userId.hashCode() : 0);
57      }
58  }