| java.lang.Object com.sun.codemodel.JType com.sun.codemodel.JClass com.sun.codemodel.JDefinedClass
All known Subclasses: com.sun.codemodel.JAnonymousClass,
Method Summary | |
public JDefinedClass | _annotationTypeDeclaration(String name) | public JDefinedClass | _class(int mods, String name) Add a new nested class to this class. | public JDefinedClass | _class(int mods, String name, boolean isInterface) | public JDefinedClass | _class(int mods, String name, ClassType classTypeVal) | public JDefinedClass | _class(String name) Add a new public nested class to this class. | public JDefinedClass | _enum(String name) | public JDefinedClass | _enum(int mods, String name) | public JDefinedClass | _extends(JClass superClass) This class extends the specifed class. | public JDefinedClass | _extends(Class superClass) | public JClass | _extends() Returns the class extended by this class. | public JDefinedClass | _implements(JClass iface) This class implements the specifed interface. | public JDefinedClass | _implements(Class iface) | public Iterator<JClass> | _implements() Returns an iterator that walks the nested classes defined in this
class. | public JDefinedClass | _interface(int mods, String name) Add an interface to this package. | public JDefinedClass | _interface(String name) Adds a public interface to this package. | final public JPackage | _package() | public JAnnotationUse | annotate(Class<? extends Annotation> clazz) | public JAnnotationUse | annotate(JClass clazz) | public W | annotate2(Class<W> clazz) | public String | binaryName() | final public Iterator<JDefinedClass> | classes() Returns an iterator that walks the nested classes defined in this
class. | public JMethod | constructor(int mods) Adds a constructor to this class. | public Iterator | constructors() Returns an iterator that walks the constructors defined in this class. | public void | declare(JFormatter f) | protected void | declareBody(JFormatter f) prints the body of a class. | public void | direct(String string) Places the given string directly inside the generated class. | public JEnumConstant | enumConstant(String name) If the named enum already exists, the reference to it is returned. | public JFieldVar | field(int mods, JType type, String name) Adds a field to the list of field members of this JDefinedClass. | public JFieldVar | field(int mods, Class type, String name) | public JFieldVar | field(int mods, JType type, String name, JExpression init) Adds a field to the list of field members of this JDefinedClass.
Parameters: mods - Modifiers for this field. Parameters: type - JType of this field. Parameters: name - Name of this field. Parameters: init - Initial value of this field. | public JFieldVar | field(int mods, Class type, String name, JExpression init) | public Map<String, JFieldVar> | fields() Returns all the fields declred in this class. | public String | fullName() Gets the fully qualified name of this class. | public JTypeVar | generify(String name) | public JTypeVar | generify(String name, Class bound) | public JTypeVar | generify(String name, JClass bound) | public ClassType | getClassType() | public JMethod | getConstructor(JType[] argTypes) Looks for a method that has the specified method signature
and return it. | public JMethod | getMethod(String name, JType[] argTypes) Looks for a method that has the specified method signature
and return it. | public JPackage | getPackage() | public void | hide() Mark this file as hidden, so that this file won't be
generated. | public JBlock | init() Creates, if necessary, and returns the static initializer
for this class. | public boolean | isAbstract() | public boolean | isAnnotationTypeDeclaration() | final public boolean | isAnonymous() Returns true if this is an anonymous class. | public boolean | isClass() | public boolean | isHidden() | public boolean | isInterface() | public boolean | isPackage() | public JDocComment | javadoc() | final public JClass[] | listClasses() Returns all the nested classes defined in this class. | public JMethod | method(int mods, JType type, String name) Add a method to the list of method members of this JDefinedClass instance. | public JMethod | method(int mods, Class type, String name) | public Collection<JMethod> | methods() Returns the set of methods defined in this class. | public String | name() JClass name accessor. | public JClass | outer() | final public JClassContainer | parentContainer() | public void | removeField(JFieldVar field) Removes a
JFieldVar from this class.
throws: IllegalArgumentException - if the given field is not a field on this class. | protected JClass | substituteParams(JTypeVar[] variables, List<JClass> bindings) | public JTypeVar[] | typeParams() |
metadata | public Object metadata(Code) | | Client-app spcific metadata associated with this user-created class.
|
JDefinedClass | JDefinedClass(JCodeModel owner, int mods, String name)(Code) | | Constructor for creating anonymous inner class.
|
_class | public JDefinedClass _class(int mods, String name) throws JClassAlreadyExistsException(Code) | | Add a new nested class to this class.
Parameters: mods - Modifiers for this class declaration Parameters: name - Name of class to be added to this package Newly generated class |
_extends | public JDefinedClass _extends(JClass superClass)(Code) | | This class extends the specifed class.
Parameters: superClass - Superclass for this class This class |
_extends | public JClass _extends()(Code) | | Returns the class extended by this class.
|
_implements | public JDefinedClass _implements(JClass iface)(Code) | | This class implements the specifed interface.
Parameters: iface - Interface that this class implements This class |
_implements | public Iterator<JClass> _implements()(Code) | | Returns an iterator that walks the nested classes defined in this
class.
|
_interface | public JDefinedClass _interface(int mods, String name) throws JClassAlreadyExistsException(Code) | | Add an interface to this package.
Parameters: mods - Modifiers for this interface declaration Parameters: name - Name of interface to be added to this package Newly generated interface |
annotate | public JAnnotationUse annotate(Class<? extends Annotation> clazz)(Code) | | Adding ability to annotate a class
Parameters: clazz - The annotation class to annotate the class with |
annotate | public JAnnotationUse annotate(JClass clazz)(Code) | | Adding ability to annotate a class
Parameters: clazz - The annotation class to annotate the class with |
constructor | public JMethod constructor(int mods)(Code) | | Adds a constructor to this class.
Parameters: mods - Modifiers for this constructor |
constructors | public Iterator constructors()(Code) | | Returns an iterator that walks the constructors defined in this class.
|
declareBody | protected void declareBody(JFormatter f)(Code) | | prints the body of a class.
|
direct | public void direct(String string)(Code) | | Places the given string directly inside the generated class.
This method can be used to add methods/fields that are not
generated by CodeModel.
This method should be used only as the last resort.
|
enumConstant | public JEnumConstant enumConstant(String name)(Code) | | If the named enum already exists, the reference to it is returned.
Otherwise this method generates a new enum reference with the given
name and returns it.
Parameters: name - The name of the constant.The generated type-safe enum constant. |
field | public JFieldVar field(int mods, JType type, String name)(Code) | | Adds a field to the list of field members of this JDefinedClass.
Parameters: mods - Modifiers for this field Parameters: type - JType of this field Parameters: name - Name of this field Newly generated field |
field | public JFieldVar field(int mods, JType type, String name, JExpression init)(Code) | | Adds a field to the list of field members of this JDefinedClass.
Parameters: mods - Modifiers for this field. Parameters: type - JType of this field. Parameters: name - Name of this field. Parameters: init - Initial value of this field. Newly generated field |
fields | public Map<String, JFieldVar> fields()(Code) | | Returns all the fields declred in this class.
The returned
Map is a read-only live view.
always non-null. |
fullName | public String fullName()(Code) | | Gets the fully qualified name of this class.
|
getConstructor | public JMethod getConstructor(JType[] argTypes)(Code) | | Looks for a method that has the specified method signature
and return it.
null if not found. |
getMethod | public JMethod getMethod(String name, JType[] argTypes)(Code) | | Looks for a method that has the specified method signature
and return it.
null if not found. |
hide | public void hide()(Code) | | Mark this file as hidden, so that this file won't be
generated.
This feature could be used to generate code that refers
to class X, without actually generating X.java.
|
init | public JBlock init()(Code) | | Creates, if necessary, and returns the static initializer
for this class.
JBlock containing initialization statements for this class |
isAbstract | public boolean isAbstract()(Code) | | |
isAnnotationTypeDeclaration | public boolean isAnnotationTypeDeclaration()(Code) | | This method indicates if the interface
is an annotationTypeDeclaration
|
isAnonymous | final public boolean isAnonymous()(Code) | | Returns true if this is an anonymous class.
|
isClass | public boolean isClass()(Code) | | |
isHidden | public boolean isHidden()(Code) | | |
isInterface | public boolean isInterface()(Code) | | |
isPackage | public boolean isPackage()(Code) | | |
javadoc | public JDocComment javadoc()(Code) | | Creates, if necessary, and returns the class javadoc for this
JDefinedClass
JDocComment containing javadocs for this class |
listClasses | final public JClass[] listClasses()(Code) | | Returns all the nested classes defined in this class.
|
method | public JMethod method(int mods, JType type, String name)(Code) | | Add a method to the list of method members of this JDefinedClass instance.
Parameters: mods - Modifiers for this method Parameters: type - Return type for this method Parameters: name - Name of the method Newly generated JMethod |
name | public String name()(Code) | | JClass name accessor.
For example, for java.util.List , this method
returns "List" "
Name of this class |
|
|