KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > explorer > plugin > java > reflect > ClassVisibilityConfig


1 /*====================================================================
2
3 Objectweb Explorer Framework
4 Copyright (C) 2000-2004 INRIA - USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Jerome Moroy, Philippe Merle.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.util.explorer.plugin.java.reflect;
28
29 import java.util.Iterator JavaDoc;
30 import java.util.Vector JavaDoc;
31
32 /**
33  *
34  *
35  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>,
36  * <a HREF="mailto:Jerome.Moroy@lifl.fr">Jérôme Moroy</a>
37  *
38  * @version 0.1
39  */

40 public class ClassVisibilityConfig
41     extends Vector JavaDoc {
42
43     //==================================================================
44
//
45
// Internal states.
46
//
47
//==================================================================
48

49     /** The <code>String</code> value representing an inner class. */
50     public static final String JavaDoc INNER_CLASS = "inner_class";
51
52     /** The <code>String</code> value representing an <code>attribute</code>. */
53     public static final String JavaDoc ATTRIBUTE = "attribute";
54
55     /** The <code>String</code> value representing a <code>method</code>. */
56     public static final String JavaDoc METHOD = "method";
57     
58     /** The <code>String</code> value representing the <code>private</code> modifier. */
59     public static final String JavaDoc PRIVATE = "private";
60     
61     /** The <code>String</code> value representing the <code>protected</code> modifier. */
62     public static final String JavaDoc PROTECTED = "protected";
63     
64     /** The <code>String</code> value representing the <code>public</code> modifier. */
65     public static final String JavaDoc PUBLIC = "public";
66     
67     /** The <code>String</code> value representing the <code>static</code> modifier. */
68     public static final String JavaDoc STATIC = "static";
69     
70     /** The <code>String</code> value representing the <code>final</code> modifier. */
71     public static final String JavaDoc FINAL = "final";
72     
73     /** The <code>String</code> value representing the <code>abstract</code> modifier. */
74     public static final String JavaDoc ABSTRACT = "abstract";
75     
76     /** The <code>String</code> value representing the default modifier (neither public, nor protected, nor private). */
77     public static final String JavaDoc PACKAGE = "package";
78     
79     /** The <code>String</code> value representing the tree inheritance visibility. */
80     public static final String JavaDoc TREE_INHERITANCE = "tree-inheritance";
81
82     /** The <code>String</code> value representing the tree inheritance view. */
83     public static final String JavaDoc FLAT_VIEW = "flat-view";
84     
85     /** The <code>String</code> value representing the type of a field. */
86     public static final String JavaDoc TYPE = "type";
87     
88     /** The <code>String</code> value indicating that the params of a method have to be displayed. */
89     public static final String JavaDoc PARAMS = "params";
90     
91     /** The <code>String</code> value indicating that the return type of a method have to be displayed. */
92     public static final String JavaDoc RETURN_TYPE = "return-type";
93     
94     /** The <code>String</code> value indicating that the declaring class of a method have to be displayed. */
95     public static final String JavaDoc DECLARING_CLASS = "declaring-class";
96     
97     //==================================================================
98
//
99
// No constructor.
100
//
101
//==================================================================
102

103     //==================================================================
104
//
105
// No internal method.
106
//
107
//==================================================================
108

109     //==================================================================
110
//
111
// Surcharging Object methods.
112
//
113
//==================================================================
114

115     public Object JavaDoc clone(){
116         ClassVisibilityConfig classVisibilityConfig = new ClassVisibilityConfig();
117         Iterator JavaDoc it = iterator();
118         while (it.hasNext()) {
119             String JavaDoc element = (String JavaDoc) it.next();
120             classVisibilityConfig.put(new String JavaDoc(element), true);
121         }
122         return classVisibilityConfig;
123     }
124
125     //==================================================================
126
//
127
// Public methods.
128
//
129
//==================================================================
130

131     /**
132      * Returns the value to which the specified key is mapped in this identity ClassVisibilityMap,
133      * or false if the map contains no mapping for this key.
134      *
135      * @param key The key whose associated value is to be returned.
136      *
137      * @return The corresponding value.
138      */

139     public boolean get(String JavaDoc key){
140         return contains(key);
141     }
142
143     /**
144      * Associates the specified value with the specified key in this map.
145      * If the map previously contained a mapping for this key, the old value is replaced.
146      *
147      * @param key Key with which the specified value is to be associated.
148      * @param value value to be associated with the specified key.
149      */

150     public void put(String JavaDoc key, boolean value){
151         if(!value)
152             remove(key);
153         else if(!contains(key))
154             add(key);
155     }
156     
157 }
158
159  
Popular Tags