Package com.sun.codemodel
Interface JClassContainer
- All Known Implementing Classes:
JDefinedClass
,JPackage
public interface JClassContainer
The common aspect of a package and a class.
-
Method Summary
Modifier and TypeMethodDescriptionAdd an annotationType Declaration to this packageAdd a new class to this package/class.Deprecated.Creates a new class/enum/interface/annotation.Add a new public class to this class/package.Add a public enum to this package_interface
(int mods, String name) Add an interface to this class/package._interface
(String name) Adds a public interface to this package.classes()
Returns an iterator that walks the nested classes defined in this class.Gets the nearest package parent.boolean
isClass()
Returns true if the container is a class.boolean
Returns true if the container is a package.owner()
Get the root code model object.Parent JClassContainer.
-
Method Details
-
isClass
boolean isClass()Returns true if the container is a class. -
isPackage
boolean isPackage()Returns true if the container is a package. -
_class
Add a new class to this package/class.- Parameters:
mods
- Modifiers for this class declarationname
- Name of class to be added to this package- Returns:
- Newly generated class
- Throws:
JClassAlreadyExistsException
- When the specified class/interface was already created.
-
_class
Add a new public class to this class/package.- Throws:
JClassAlreadyExistsException
- When the specified class/interface was already created.
-
_interface
Add an interface to this class/package.- Parameters:
mods
- Modifiers for this interface declarationname
- Name of interface to be added to this package- Returns:
- Newly generated interface
- Throws:
JClassAlreadyExistsException
- When the specified class/interface was already created.
-
_interface
Adds a public interface to this package.- Throws:
JClassAlreadyExistsException
- When the specified class/interface was already created.
-
_class
@Deprecated JDefinedClass _class(int mods, String name, boolean isInterface) throws JClassAlreadyExistsException Deprecated.Create a new class or a new interface.- Throws:
JClassAlreadyExistsException
-
_class
Creates a new class/enum/interface/annotation.- Throws:
JClassAlreadyExistsException
-
classes
Iterator<JDefinedClass> classes()Returns an iterator that walks the nested classes defined in this class. -
parentContainer
JClassContainer parentContainer()Parent JClassContainer. If this is a package, this method returns a parent package, or null if this package is the root package. If this is an outer-most class, this method returns a package to which it belongs. If this is an inner class, this method returns the outer class. -
getPackage
JPackage getPackage()Gets the nearest package parent.If
this.isPackage()
, then returnthis
. -
owner
JCodeModel owner()Get the root code model object. -
_annotationTypeDeclaration
Add an annotationType Declaration to this package- Parameters:
name
- Name of the annotation Type declaration to be added to this package- Returns:
- newly created Annotation Type Declaration
- Throws:
JClassAlreadyExistsException
- When the specified class/interface was already created.
-
_enum
Add a public enum to this package- Parameters:
name
- Name of the enum to be added to this package- Returns:
- newly created Enum
- Throws:
JClassAlreadyExistsException
- When the specified class/interface was already created.
-
_class(int, String, ClassType)