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 RemotedImpl implements Remoted {
21: public RemotedImpl() {
22: this .value = "";
23: }
24:
25: public RemotedImpl(String value) {
26: if (value == null) {
27: throw new NullPointerException("@Remoted");
28: }
29: this .value = value;
30: }
31:
32: public String value() {
33: return this .value;
34: }
35:
36: public Class<? extends Annotation> annotationType() {
37: return Remoted.class;
38: }
39:
40: @Override
41: public boolean equals(Object t) {
42: if (!(t instanceof Remoted)) {
43: return false;
44: }
45:
46: Remoted that = (Remoted) t;
47: return this .value.equals(that.value());
48: }
49:
50: @Override
51: public int hashCode() {
52: // Annotation spec sez:
53: return 127 * "value".hashCode() ^ value.hashCode();
54: }
55:
56: @Override
57: public String toString() {
58: return "@" + Remoted.class.getName() + "(value=" + value + ")";
59: }
60:
61: private final String value;
62: }
|