KickJava   Java API By Example, From Geeks To Geeks.

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


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