Top Description Methods
com.sun.codemodel

public Interface JClassContainer

Known Direct Implementers
com.sun.codemodel.JDefinedClass, com.sun.codemodel.JPackage
Imports
java.util.Iterator

The common aspect of a package and a class.

Method Summary

Modifier and TypeMethod and Description
public JDefinedClass

Returns:

newly created Annotation Type Declaration
_annotationTypeDeclaration
(String
Name of the annotation Type declaration to be added to this package
name
)

Add an annotationType Declaration to this package

public JDefinedClass

Returns:

Newly generated class
_class
(int
Modifiers for this class declaration
mods
,
String
Name of class to be added to this package
name
)

Add a new class to this package/class.

public JDefinedClass
_class(String name)

Add a new public class to this class/package.

public JDefinedClass
_class(int mods, String name, boolean isInterface)

Create a new class or a new interface.

public JDefinedClass
_class(int mods, String name, ClassType kind)

Creates a new class/enum/interface/annotation.

public JDefinedClass

Returns:

newly created Enum
_enum
(String
Name of the enum to be added to this package
name
)

Add a public enum to this package

public JDefinedClass

Returns:

Newly generated interface
_interface
(int
Modifiers for this interface declaration
mods
,
String
Name of interface to be added to this package
name
)

Add an interface to this class/package.

public JDefinedClass
_interface(String name)

Adds a public interface to this package.

public Iterator<JDefinedClass>
classes()

Returns an iterator that walks the nested classes defined in this class.

public JPackage
getPackage()

Gets the nearest package parent.

public boolean
isClass()

Returns true if the container is a class.

public boolean
isPackage()

Returns true if the container is a package.

public JCodeModel
owner()

Get the root code model object.

public JClassContainer
parentContainer()

Parent JClassContainer.

Method Detail

_annotationTypeDeclarationback to summary
public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException

Add an annotationType Declaration to this package

Parameters
name:String

Name of the annotation Type declaration to be added to this package

Returns:JDefinedClass

newly created Annotation Type Declaration

Exceptions
JClassAlreadyExistsException:
When the specified class/interface was already created.
_classback to summary
public JDefinedClass _class(int mods, String name) throws JClassAlreadyExistsException

Add a new class to this package/class.

Parameters
mods:int

Modifiers for this class declaration

name:String

Name of class to be added to this package

Returns:JDefinedClass

Newly generated class

Exceptions
JClassAlreadyExistsException:
When the specified class/interface was already created.
_classback to summary
public JDefinedClass _class(String name) throws JClassAlreadyExistsException

Add a new public class to this class/package.

Exceptions
JClassAlreadyExistsException:
When the specified class/interface was already created.
_classback to summary
public JDefinedClass _class(int mods, String name, boolean isInterface) throws JClassAlreadyExistsException

Create a new class or a new interface.

Annotations
@Deprecated
_classback to summary
public JDefinedClass _class(int mods, String name, ClassType kind) throws JClassAlreadyExistsException

Creates a new class/enum/interface/annotation.

_enumback to summary
public JDefinedClass _enum(String name) throws JClassAlreadyExistsException

Add a public enum to this package

Parameters
name:String

Name of the enum to be added to this package

Returns:JDefinedClass

newly created Enum

Exceptions
JClassAlreadyExistsException:
When the specified class/interface was already created.
_interfaceback to summary
public JDefinedClass _interface(int mods, String name) throws JClassAlreadyExistsException

Add an interface to this class/package.

Parameters
mods:int

Modifiers for this interface declaration

name:String

Name of interface to be added to this package

Returns:JDefinedClass

Newly generated interface

Exceptions
JClassAlreadyExistsException:
When the specified class/interface was already created.
_interfaceback to summary
public JDefinedClass _interface(String name) throws JClassAlreadyExistsException

Adds a public interface to this package.

Exceptions
JClassAlreadyExistsException:
When the specified class/interface was already created.
classesback to summary
public Iterator<JDefinedClass> classes()

Returns an iterator that walks the nested classes defined in this class.

getPackageback to summary
public JPackage getPackage()

Gets the nearest package parent.

If this.isPackage(), then return this.

isClassback to summary
public boolean isClass()

Returns true if the container is a class.

isPackageback to summary
public boolean isPackage()

Returns true if the container is a package.

ownerback to summary
public JCodeModel owner()

Get the root code model object.

parentContainerback to summary
public 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.