KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > ba > AnnotationRetentionDatabase


1 /*
2  * FindBugs - Find Bugs in Java programs
3  * Copyright (C) 2005, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs.ba;
21
22 import java.util.HashMap JavaDoc;
23
24 public class AnnotationRetentionDatabase {
25     private HashMap JavaDoc<String JavaDoc, Boolean JavaDoc> annotationRetention = new HashMap JavaDoc<String JavaDoc, Boolean JavaDoc>();
26
27     public boolean hasClassfileRetention(String JavaDoc dottedClassName) {
28         Boolean JavaDoc result = annotationRetention.get(dottedClassName);
29         if (result == null) return false;
30         return result;
31     }
32
33     /** return false if it has class retention *or* if the retention is unknown */
34     public boolean lacksClassfileRetention(String JavaDoc dottedClassName) {
35         Boolean JavaDoc result = annotationRetention.get(dottedClassName);
36         if (result == null) return false;
37         return !result;
38     }
39
40     public void setClassfileRetention(String JavaDoc dottedClassName, boolean value) {
41         annotationRetention.put(dottedClassName, Boolean.valueOf(value));
42     }
43
44 }
45
Popular Tags