KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > guice > InitParamImpl


1 /*
2  * Copyright 2007 Tim Peierls
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.directwebremoting.guice;
17
18 import java.lang.annotation.Annotation JavaDoc;
19
20
21 class InitParamImpl implements InitParam
22 {
23     public InitParamImpl(ParamName value)
24     {
25         if (value == null)
26         {
27             throw new NullPointerException JavaDoc("@InitParam");
28         }
29         this.value = value;
30     }
31
32     public ParamName value()
33     {
34         return this.value;
35     }
36
37     public Class JavaDoc<? extends Annotation JavaDoc> annotationType()
38     {
39         return InitParam.class;
40     }
41
42     public boolean equals(Object JavaDoc t)
43     {
44         if (!(t instanceof InitParam))
45         {
46             return false;
47         }
48
49         InitParam that = (InitParam) t;
50         return this.value.equals(that.value());
51     }
52
53     public int hashCode()
54     {
55         // Annotation spec sez:
56
return 127 * "value".hashCode() ^ value.hashCode();
57     }
58
59     public String JavaDoc toString()
60     {
61         return "@" + InitParam.class.getName() + "(value=" + value + ")";
62     }
63
64     private final ParamName value;
65 }
66
Popular Tags