Mon, 04 May 2009 21:10:41 -0700
6658158: Mutable statics in SAAJ (findbugs)
6658163: txw2.DatatypeWriter.BUILDIN is a mutable static (findbugs)
Reviewed-by: darcy
1 /*
2 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25 package com.sun.codemodel.internal;
27 import java.util.Iterator;
29 /**
30 * The common aspect of a package and a class.
31 */
32 public interface JClassContainer {
34 /**
35 * Returns true if the container is a class.
36 */
37 boolean isClass();
38 /**
39 * Returns true if the container is a package.
40 */
41 boolean isPackage();
43 /**
44 * Add a new class to this package/class.
45 *
46 * @param mods
47 * Modifiers for this class declaration
48 *
49 * @param name
50 * Name of class to be added to this package
51 *
52 * @return Newly generated class
53 *
54 * @exception JClassAlreadyExistsException
55 * When the specified class/interface was already created.
56 */
57 JDefinedClass _class(int mods, String name) throws JClassAlreadyExistsException;
59 /**
60 * Add a new public class to this class/package.
61 *
62 * @exception JClassAlreadyExistsException
63 * When the specified class/interface was already created.
64 */
65 public JDefinedClass _class(String name) throws JClassAlreadyExistsException;
67 /**
68 * Add an interface to this class/package.
69 *
70 * @param mods
71 * Modifiers for this interface declaration
72 *
73 * @param name
74 * Name of interface to be added to this package
75 *
76 * @return Newly generated interface
77 *
78 * @exception JClassAlreadyExistsException
79 * When the specified class/interface was already created.
80 */
81 public JDefinedClass _interface(int mods, String name) throws JClassAlreadyExistsException;
83 /**
84 * Adds a public interface to this package.
85 *
86 * @exception JClassAlreadyExistsException
87 * When the specified class/interface was already created.
88 */
89 public JDefinedClass _interface(String name) throws JClassAlreadyExistsException;
91 /**
92 * Create a new class or a new interface.
93 *
94 * @deprecated
95 * use {@link #_class(int, String, ClassType)}
96 */
97 public JDefinedClass _class(int mods, String name, boolean isInterface )
98 throws JClassAlreadyExistsException;
100 /**
101 * Creates a new class/enum/interface/annotation.
102 */
103 public JDefinedClass _class(int mods, String name, ClassType kind )
104 throws JClassAlreadyExistsException;
107 /**
108 * Returns an iterator that walks the nested classes defined in this
109 * class.
110 */
111 public Iterator<JDefinedClass> classes();
113 /**
114 * Parent JClassContainer.
115 *
116 * If this is a package, this method returns a parent package,
117 * or null if this package is the root package.
118 *
119 * If this is an outer-most class, this method returns a package
120 * to which it belongs.
121 *
122 * If this is an inner class, this method returns the outer
123 * class.
124 */
125 public JClassContainer parentContainer();
127 /**
128 * Gets the nearest package parent.
129 *
130 * <p>
131 * If <tt>this.isPackage()</tt>, then return <tt>this</tt>.
132 */
133 public JPackage getPackage();
135 /**
136 * Get the root code model object.
137 */
138 public JCodeModel owner();
140 /**
141 * Add an annotationType Declaration to this package
142 * @param name
143 * Name of the annotation Type declaration to be added to this package
144 * @return
145 * newly created Annotation Type Declaration
146 * @exception JClassAlreadyExistsException
147 * When the specified class/interface was already created.
149 */
150 public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException;
152 /**
153 * Add a public enum to this package
154 * @param name
155 * Name of the enum to be added to this package
156 * @return
157 * newly created Enum
158 * @exception JClassAlreadyExistsException
159 * When the specified class/interface was already created.
161 */
162 public JDefinedClass _enum (String name) throws JClassAlreadyExistsException;
164 }