704aac937c12fb20bc9d8c8ca35a6a14b6230365
[xmlrouter] / common / src / main / java / org / wamblee / xmlrouter / common / Id.java
1 /*
2  * Copyright 2005-2011 the original author or authors.
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  * 
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  * 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.wamblee.xmlrouter.common;
17
18 public class Id<T> {
19
20     private long id;
21
22     public Id(long aId) {
23         id = aId;
24     }
25
26     public long getId() {
27         return id;
28     }
29
30     @Override
31     public int hashCode() {
32         return ((Long) id).hashCode();
33     }
34
35     @Override
36     public boolean equals(Object aObj) {
37         if (aObj == null) {
38             return false;
39         }
40         if (!(aObj instanceof Id)) {
41             return false;
42         }
43         return id == ((Id<T>) aObj).id;
44     }
45
46     @Override
47     public String toString() {
48         return id + "";
49     }
50 }