01: /*
02: * Copyright 2007 Tim Peierls
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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;
19:
20: class InitParamImpl implements InitParam {
21: public InitParamImpl(ParamName value) {
22: if (value == null) {
23: throw new NullPointerException("@InitParam");
24: }
25: this .value = value;
26: }
27:
28: public ParamName value() {
29: return this .value;
30: }
31:
32: public Class<? extends Annotation> annotationType() {
33: return InitParam.class;
34: }
35:
36: @Override
37: public boolean equals(Object t) {
38: if (!(t instanceof InitParam)) {
39: return false;
40: }
41:
42: InitParam that = (InitParam) t;
43: return this .value.equals(that.value());
44: }
45:
46: @Override
47: public int hashCode() {
48: // Annotation spec sez:
49: return 127 * "value".hashCode() ^ value.hashCode();
50: }
51:
52: @Override
53: public String toString() {
54: return "@" + InitParam.class.getName() + "(value=" + value
55: + ")";
56: }
57:
58: private final ParamName value;
59: }
|