src/share/classes/com/sun/codemodel/internal/JClassContainer.java

Mon, 04 May 2009 21:10:41 -0700

author
tbell
date
Mon, 04 May 2009 21:10:41 -0700
changeset 50
42dfec6871f6
parent 45
31822b475baa
permissions
-rw-r--r--

6658158: Mutable statics in SAAJ (findbugs)
6658163: txw2.DatatypeWriter.BUILDIN is a mutable static (findbugs)
Reviewed-by: darcy

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

mercurial