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
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description JDefinedClass
_annotationTypeDeclaration(java.lang.String name)
Add an annotationType Declaration to this packageJDefinedClass
_class(int mods, java.lang.String name)
Add a new class to this package/class.JDefinedClass
_class(int mods, java.lang.String name, boolean isInterface)
Deprecated.JDefinedClass
_class(int mods, java.lang.String name, ClassType kind)
Creates a new class/enum/interface/annotation.JDefinedClass
_class(java.lang.String name)
Add a new public class to this class/package.JDefinedClass
_enum(java.lang.String name)
Add a public enum to this packageJDefinedClass
_interface(int mods, java.lang.String name)
Add an interface to this class/package.JDefinedClass
_interface(java.lang.String name)
Adds a public interface to this package.java.util.Iterator<JDefinedClass>
classes()
Returns an iterator that walks the nested classes defined in this class.JPackage
getPackage()
Gets the nearest package parent.boolean
isClass()
Returns true if the container is a class.boolean
isPackage()
Returns true if the container is a package.JCodeModel
owner()
Get the root code model object.JClassContainer
parentContainer()
Parent JClassContainer.
-
-
-
Method Detail
-
isClass
boolean isClass()
Returns true if the container is a class.
-
isPackage
boolean isPackage()
Returns true if the container is a package.
-
_class
JDefinedClass _class(int mods, java.lang.String name) throws JClassAlreadyExistsException
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
JDefinedClass _class(java.lang.String name) throws JClassAlreadyExistsException
Add a new public class to this class/package.- Throws:
JClassAlreadyExistsException
- When the specified class/interface was already created.
-
_interface
JDefinedClass _interface(int mods, java.lang.String name) throws JClassAlreadyExistsException
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
JDefinedClass _interface(java.lang.String name) throws JClassAlreadyExistsException
Adds a public interface to this package.- Throws:
JClassAlreadyExistsException
- When the specified class/interface was already created.
-
_class
JDefinedClass _class(int mods, java.lang.String name, boolean isInterface) throws JClassAlreadyExistsException
Deprecated.Create a new class or a new interface.- Throws:
JClassAlreadyExistsException
-
_class
JDefinedClass _class(int mods, java.lang.String name, ClassType kind) throws JClassAlreadyExistsException
Creates a new class/enum/interface/annotation.- Throws:
JClassAlreadyExistsException
-
classes
java.util.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
JDefinedClass _annotationTypeDeclaration(java.lang.String name) throws JClassAlreadyExistsException
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
JDefinedClass _enum(java.lang.String name) throws JClassAlreadyExistsException
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.
-
-