This class models a declaration, and since a declaration can be always
used as a reference, it inherits JClass.
You'd want to generate fields and methods on a class.
See method(int, JType, String) and field(int, JType, String).
| Modifier and Type | Field and Description |
|---|---|
| private List | annotations
Annotations on this variable. |
| private Map | classes
Nested classes as a map from name to JDefinedClass. |
| private final ClassType | classType
Default value is class or interface or annotationTypeDeclaration or enum |
| private final List | constructors
Set of constructors for this class, if any |
| private String | directBlock
String that will be put directly inside the generated code. |
| private final Map | enumConstantsByName
Set of enum constants that are keyed by names. |
| pack-priv final Map | fields
Fields keyed by their names. |
| private final JGenerifiableImpl | generifiable
Helper class to implement |
| private boolean | hideFile
Flag that controls whether this class should be really generated or not. |
| private JBlock | init
Static initializer, if this class has one |
| private JBlock | instanceInit
Instance initializer, if this class has one |
| private final Set | interfaces
List of interfaces that this class implements |
| private JDocComment | jdoc
class javadoc |
| public Object | metadata
Client-app spcific metadata associated with this user-created class. |
| private final List | methods
Set of methods that are members of this class |
| private JMods | mods
Modifiers for the class declaration |
| private String | name
Name of this class. |
| private JClassContainer | |
| private JClass | superClass
Name of the super class of this class. |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | JDefinedClass(JCodeModel owner, int mods, String name)
Constructor for creating anonymous inner class. |
| private | |
| private | JDefinedClass(int
Modifiers for this class declaration mods, String Name of this class name, JClassContainer parent, JCodeModel owner, ClassType classTypeVal)JClass constructor |
| Modifier and Type | Method and Description |
|---|---|
| public JDefinedClass | Returns: newly created Annotation Type DeclarationName of the annotation Type declaration to be added to this package name)Implements com. Add an annotationType Declaration to this package |
| public JDefinedClass | Returns: Newly generated classModifiers for this class declaration mods, String Name of class to be added to this package name)Implements com. Add a new nested class to this class. |
| public JDefinedClass | _class(int mods, String name, boolean isInterface)
Implements com.
Deprecated
Create a new class or a new interface. |
| public JDefinedClass | _class(int mods, String name, ClassType classTypeVal)
Implements com. Creates a new class/enum/interface/annotation. |
| public JDefinedClass | _class(String name)
Implements com. Add a new public nested class to this class. |
| public JDefinedClass | Returns: newly created EnumName of the enum to be added to this package name)Implements com. Add a public enum to this package |
| public JDefinedClass | |
| public JDefinedClass | |
| public JDefinedClass | |
| public JClass | _extends()
Implements abstract com. Returns the class extended by this class. |
| public JDefinedClass | Returns: This classInterface that this class implements iface)This class implements the specifed interface. |
| public JDefinedClass | |
| public Iterator | _implements()
Implements abstract com. Returns an iterator that walks the nested classes defined in this class. |
| public JDefinedClass | Returns: Newly generated interfaceModifiers for this interface declaration mods, String Name of interface to be added to this package name)Implements com. Add an interface to this package. |
| public JDefinedClass | _interface(String name)
Implements com. Adds a public interface to this package. |
| public final JPackage | _package()
Implements abstract com. Gets the package to which this class belongs. |
| public JAnnotationUse | annotate(Class<? extends Annotation>
The annotation class to annotate the class with clazz)Implements com. Adding ability to annotate a class |
| public JAnnotationUse | annotate(JClass
The annotation class to annotate the class with clazz)Implements com. Adding ability to annotate a class |
| public <W extends JAnnotationWriter | annotate2(Class<W> clazz)
Implements com. Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations. |
| public Collection | annotations()
Implements com. Read-only live view of all annotations on this |
| public String | |
| public final Iterator | classes()
Implements com. Returns an iterator that walks the nested classes defined in this class. |
| public JMethod | |
| public Iterator | |
| public void | |
| protected void | |
| public void | |
| public JEnumConstant | Returns: The generated type-safe enum constant.The name of the constant. name)If the named enum already exists, the reference to it is returned. |
| public Map | Returns: Set of enum constants keyed by namesReturns set of enum constants keyed by names. |
| public JFieldVar | |
| public JFieldVar | |
| public JFieldVar | Returns: Newly generated fieldModifiers for this field. mods, JType JType of this field. type, String Name of this field. name, JExpression Initial value of this field. init)Adds a field to the list of field members of this JDefinedClass. |
| public JFieldVar | |
| public Map | |
| public String | fullName()
Implements abstract com. Gets the fully qualified name of this class. |
| public JTypeVar | generify(String name)
Implements com. Adds a new type variable to this declaration. |
| public JTypeVar | generify(String name, Class<?> bound)
Implements com. Adds a new type variable to this declaration with a bound. |
| public JTypeVar | generify(String name, JClass bound)
Implements com. Adds a new type variable to this declaration with a bound. |
| private Map | |
| public ClassType | |
| public JMethod | Returns: null if not found.Looks for a method that has the specified method signature and return it. |
| public JMethod | |
| public JPackage | getPackage()
Implements com. Gets the nearest package parent. |
| public void | |
| public JBlock | Returns: JBlock containing initialization statements for this classCreates, if necessary, and returns the static initializer for this class. |
| public JBlock | Returns: JBlock containing initialization statements for this classCreates, if necessary, and returns the instance initializer for this class. |
| public boolean | isAbstract()
Implements abstract com. Checks if this class is an abstract class. |
| public boolean | |
| public final boolean | |
| public boolean | isClass()
Implements com. Returns true if the container is a class. |
| public boolean | |
| public boolean | isInterface()
Implements abstract com. Checks if this object represents an interface. |
| public boolean | isPackage()
Implements com. Returns true if the container is a package. |
| public JDocComment | Returns: JDocComment containing javadocs for this classImplements com. Creates, if necessary, and returns the class javadoc for this JDefinedClass |
| public final JClass[] | |
| public JMethod | |
| public JMethod | |
| public Collection | |
| public JMods | |
| public String | Returns: Name of this classImplements abstract com. JClass name accessor. |
| public JClass | outer()
Overrides com. Returns the class in which this class is nested, or |
| public final JClassContainer | parentContainer()
Implements com. Parent JClassContainer. |
| public boolean | removeAnnotation(JAnnotationUse annotation)
Implements com. Removes annotation from this program element. |
| public void | |
| protected JClass | substituteParams(JTypeVar[] variables, List<JClass> bindings)
Implements abstract com. Substitutes the type variables with their actual arguments. |
| public JClass | |
| public JTypeVar[] | typeParams()
Overrides com. Implements com. Iterates all the type parameters of this class/interface. |