|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mule.devkit.model.code.Type
org.mule.devkit.model.code.TypeReference
org.mule.devkit.model.code.GeneratedClass
public class GeneratedClass
A generated Java class/interface/enum/....
This class models a declaration, and since a declaration can be always used as a reference, it inheritsTypeReference.
method(int, Type, String) and field(int, Type, String).
| Field Summary | |
|---|---|
static String |
FLOW_CONSTRUCT_FIELD_NAME
|
static String |
FLOW_CONSTRUCT_JAVADOC
|
Object |
metadata
Client-app spcific metadata associated with this user-created class. |
static String |
MULE_CONTEXT_FIELD_NAME
|
static String |
MULE_CONTEXT_JAVADOC
|
| Fields inherited from class org.mule.devkit.model.code.TypeReference |
|---|
EMPTY_ARRAY |
| Method Summary | ||
|---|---|---|
GeneratedClass |
_annotationTypeDeclaration(String name)
Add an annotationType Declaration to this package |
|
GeneratedClass |
_class(int mods,
String name)
Add a new nested class to this class. |
|
GeneratedClass |
_class(int mods,
String name,
boolean isInterface)
Deprecated. |
|
GeneratedClass |
_class(int mods,
String name,
GeneratedClassType classTypeVal)
Creates a new class/enum/interface/annotation. |
|
GeneratedClass |
_class(String name)
Add a new public nested class to this class. |
|
GeneratedClass |
_enum(int mods,
String name)
Add a public enum to this package |
|
GeneratedClass |
_enum(String name)
Add a public enum to this package |
|
TypeReference |
_extends()
Returns the class extended by this class. |
|
GeneratedClass |
_extends(Class<?> superClass)
|
|
GeneratedClass |
_extends(TypeReference superClass)
This class extends the specifed class. |
|
Iterator<TypeReference> |
_implements()
Returns an iterator that walks the nested classes defined in this class. |
|
GeneratedClass |
_implements(Class<?> iface)
|
|
GeneratedClass |
_implements(TypeReference iface)
This class implements the specifed interface. |
|
GeneratedClass |
_interface(int mods,
String name)
Add an interface to this package. |
|
GeneratedClass |
_interface(String name)
Adds a public interface to this package. |
|
GeneratedPackage |
_package()
Gets the package to which this class belongs. |
|
GeneratedAnnotationUse |
annotate(Class<? extends Annotation> clazz)
Adding ability to annotate a class |
|
GeneratedAnnotationUse |
annotate(TypeReference clazz)
Adding ability to annotate a class |
|
|
annotate2(Class<W> clazz)
Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations. |
|
Collection<GeneratedAnnotationUse> |
annotations()
Annotable.annotations() |
|
String |
binaryName()
Gets the binary name of the type. |
|
Iterator<GeneratedClass> |
classes()
Returns an iterator that walks the nested classes defined in this class. |
|
GeneratedMethod |
constructor(int mods)
Adds a constructor to this class. |
|
Iterator<GeneratedMethod> |
constructors()
Returns an iterator that walks the constructors defined in this class. |
|
void |
declare(Formatter f)
|
|
protected void |
declareBody(Formatter f)
prints the body of a class. |
|
void |
direct(String string)
Places the given string directly inside the generated class. |
|
EnumConstant |
enumConstant(String name)
If the named enum already exists, the reference to it is returned. |
|
GeneratedField |
field(int mods,
Class<?> type,
String name)
|
|
GeneratedField |
field(int mods,
Class<?> type,
String name,
GeneratedExpression init)
|
|
GeneratedField |
field(int mods,
Type type,
String name)
Adds a field to the list of field members of this DefinedClass. |
|
GeneratedField |
field(int mods,
Type type,
String name,
GeneratedExpression init)
Adds a field to the list of field members of this DefinedClass. |
|
Map<String,GeneratedField> |
fields()
Returns all the fields declred in this class. |
|
GeneratedField |
flowConstructField()
|
|
String |
fullName()
Gets the fully qualified name of this class. |
|
TypeVariable |
generify(String name)
Adds a new type variable to this declaration. |
|
TypeVariable |
generify(String name,
Class<?> bound)
Adds a new type variable to this declaration with a bound. |
|
TypeVariable |
generify(String name,
TypeReference bound)
Adds a new type variable to this declaration with a bound. |
|
GeneratedClassType |
getClassType()
|
|
GeneratedMethod |
getConstructor(Type[] argTypes)
Looks for a method that has the specified method signature and return it. |
|
GeneratedMethod |
getMethod(String name,
Type[] argTypes)
Looks for a method that has the specified method signature and return it. |
|
GeneratedPackage |
getPackage()
Gets the nearest package parent. |
|
GeneratedMethod |
getter(GeneratedField field)
Generate a getter method for the specified field |
|
void |
hide()
Mark this file as hidden, so that this file won't be generated. |
|
boolean |
implementsClass(Class clazz)
Returns whether this class implements the provided interface or not |
|
GeneratedBlock |
init()
Creates, if necessary, and returns the static initializer for this class. |
|
boolean |
isAbstract()
Checks if this class is an abstract class. |
|
boolean |
isAnnotationTypeDeclaration()
This method indicates if the interface is an annotationTypeDeclaration |
|
boolean |
isAnonymous()
Returns true if this is an anonymous class. |
|
boolean |
isClass()
Returns true if the container is a class. |
|
boolean |
isHidden()
|
|
boolean |
isInterface()
Checks if this object represents an interface. |
|
boolean |
isPackage()
Returns true if the container is a package. |
|
GeneratedJavaDocComment |
javadoc()
Creates, if necessary, and returns the class javadoc for this DefinedClass |
|
TypeReference[] |
listClasses()
Returns all the nested classes defined in this class. |
|
GeneratedMethod |
method(int mods,
Class<?> type,
Class<?> narrowedType,
String name)
|
|
GeneratedMethod |
method(int mods,
Class<?> type,
String name)
|
|
GeneratedMethod |
method(int mods,
Type type,
String name)
Add a method to the list of method members of this DefinedClass instance. |
|
Collection<GeneratedMethod> |
methods()
Returns the set of methods defined in this class. |
|
Modifiers |
mods()
|
|
GeneratedField |
muleContextField()
|
|
String |
name()
TypeReference name accessor. |
|
TypeReference |
outer()
Returns the class in which this class is nested, or null if this is a top-level class. |
|
ClassContainer |
parentContainer()
Parent ClassContainer. |
|
void |
removeField(GeneratedField field)
Removes a GeneratedField from this class. |
|
GeneratedMethod |
setter(GeneratedField field)
Generate a setter method for the specified field |
|
GeneratedMethod |
setterOverride(GeneratedField field)
Generate a setter and puts an override annotation on it |
|
protected TypeReference |
substituteParams(TypeVariable[] variables,
List<TypeReference> bindings)
Substitutes the type variables with their actual arguments. |
|
List<GeneratedClass> |
superclasses()
Find all the classes that inherit from this one. |
|
GeneratedClass |
topLevelClass()
Find the top level class that inherits from this one. |
|
String |
toString()
|
|
TypeVariable[] |
typeParams()
Iterates all the type parameters of this class/interface. |
|
| Methods inherited from class org.mule.devkit.model.code.TypeReference |
|---|
array, array, boxify, erasure, generate, getBaseClass, getBaseClass, getPrimitiveType, getTypeParameters, isAssignableFrom, isParameterized, narrow, narrow, narrow, narrow, narrow, narrow, narrow, owner, staticInvoke, staticInvoke, staticRef, staticRef, unboxify, wildcard |
| Methods inherited from class org.mule.devkit.model.code.Type |
|---|
compareTo, dotclass, elementType, equals, hashCode, isArray, isPrimitive, isReference, parse |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.mule.devkit.model.code.ClassContainer |
|---|
owner |
| Field Detail |
|---|
public static final String MULE_CONTEXT_JAVADOC
public static final String MULE_CONTEXT_FIELD_NAME
public static final String FLOW_CONSTRUCT_JAVADOC
public static final String FLOW_CONSTRUCT_FIELD_NAME
public Object metadata
| Method Detail |
|---|
public final boolean isAnonymous()
public GeneratedClass _extends(TypeReference superClass)
superClass - Superclass for this class
public GeneratedClass _extends(Class<?> superClass)
public TypeReference _extends()
_extends in class TypeReferenceTypeReference.
Even if no super class is given explicitly or this TypeReference
is not a class, this method still returns
TypeReference for Object.
If this TypeReference represents Object, return null.public GeneratedClass _implements(TypeReference iface)
iface - Interface that this class implements
public GeneratedClass _implements(Class<?> iface)
public Iterator<TypeReference> _implements()
_implements in class TypeReferenceTypeReference objects that represents those interfaces
implemented by this object.public String name()
java.util.List, this method
returns "List""
name in class TypeReferencepublic EnumConstant enumConstant(String name)
name - The name of the constant.
public String fullName()
fullName in class Typepublic String binaryName()
Type
binaryName in class Typepublic boolean isInterface()
TypeReference
isInterface in class TypeReferencepublic boolean isAbstract()
TypeReference
isAbstract in class TypeReference
public GeneratedField field(int mods,
Type type,
String name)
mods - Modifiers for this fieldtype - Type of this fieldname - Name of this field
public GeneratedField field(int mods,
Class<?> type,
String name)
public GeneratedField field(int mods,
Type type,
String name,
GeneratedExpression init)
mods - Modifiers for this field.type - Type of this field.name - Name of this field.init - Initial value of this field.
public boolean isAnnotationTypeDeclaration()
public GeneratedClass _annotationTypeDeclaration(String name)
throws ClassAlreadyExistsException
_annotationTypeDeclaration in interface ClassContainername - Name of the annotation Type declaration to be added to this package
ClassAlreadyExistsException - When the specified class/interface was already created.
public GeneratedClass _enum(String name)
throws ClassAlreadyExistsException
_enum in interface ClassContainername - Name of the enum to be added to this package
ClassAlreadyExistsException - When the specified class/interface was already created.
public GeneratedClass _enum(int mods,
String name)
throws ClassAlreadyExistsException
name - Name of the enum to be added to this packagemods - Modifiers for this enum declaration
ClassAlreadyExistsException - When the specified class/interface was already created.public GeneratedClassType getClassType()
public GeneratedField field(int mods,
Class<?> type,
String name,
GeneratedExpression init)
public Map<String,GeneratedField> fields()
Map is a read-only live view.
public void removeField(GeneratedField field)
GeneratedField from this class.
IllegalArgumentException - if the given field is not a field on this class.public GeneratedBlock init()
public GeneratedMethod constructor(int mods)
mods - Modifiers for this constructorpublic Iterator<GeneratedMethod> constructors()
public GeneratedMethod getConstructor(Type[] argTypes)
public GeneratedMethod method(int mods,
Type type,
String name)
mods - Modifiers for this methodtype - Return type for this methodname - Name of the method
public GeneratedMethod method(int mods,
Class<?> type,
String name)
public GeneratedMethod method(int mods,
Class<?> type,
Class<?> narrowedType,
String name)
public Collection<GeneratedMethod> methods()
public GeneratedMethod getMethod(String name,
Type[] argTypes)
public boolean isClass()
ClassContainer
isClass in interface ClassContainerpublic boolean isPackage()
ClassContainer
isPackage in interface ClassContainerpublic GeneratedPackage getPackage()
ClassContainer
getPackage in interface ClassContainer
public GeneratedClass _class(int mods,
String name)
throws ClassAlreadyExistsException
_class in interface ClassContainermods - Modifiers for this class declarationname - Name of class to be added to this package
ClassAlreadyExistsException - When the specified class/interface was already created.
public GeneratedClass _class(int mods,
String name,
boolean isInterface)
throws ClassAlreadyExistsException
_class in interface ClassContainerClassAlreadyExistsException
public GeneratedClass _class(int mods,
String name,
GeneratedClassType classTypeVal)
throws ClassAlreadyExistsException
ClassContainer
_class in interface ClassContainerClassAlreadyExistsExceptionpublic GeneratedClass _class(String name)
_class in interface ClassContainer
public GeneratedClass _interface(int mods,
String name)
throws ClassAlreadyExistsException
_interface in interface ClassContainermods - Modifiers for this interface declarationname - Name of interface to be added to this package
ClassAlreadyExistsException - When the specified class/interface was already created.
public GeneratedClass _interface(String name)
throws ClassAlreadyExistsException
_interface in interface ClassContainerClassAlreadyExistsException - When the specified class/interface was already created.public GeneratedJavaDocComment javadoc()
javadoc in interface Documentablepublic void hide()
public boolean isHidden()
public final Iterator<GeneratedClass> classes()
classes in interface ClassContainerpublic final TypeReference[] listClasses()
public TypeReference outer()
TypeReference
outer in class TypeReferencepublic void declare(Formatter f)
declare in interface Declarationprotected void declareBody(Formatter f)
public void direct(String string)
public final GeneratedPackage _package()
TypeReference
_package in class TypeReferencepublic final ClassContainer parentContainer()
ClassContainer
parentContainer in interface ClassContainerpublic TypeVariable generify(String name)
Generifiable
generify in interface Generifiable
public TypeVariable generify(String name,
Class<?> bound)
Generifiable
generify in interface Generifiable
public TypeVariable generify(String name,
TypeReference bound)
Generifiable
generify in interface Generifiablepublic TypeVariable[] typeParams()
TypeReferenceTypeReference represents
Set<T>, this method returns an array
that contains single TypeVariable for 'T'.
typeParams in interface GenerifiabletypeParams in class TypeReference
protected TypeReference substituteParams(TypeVariable[] variables,
List<TypeReference> bindings)
TypeReferenceTypeReference
for Map<String,Map<Integer>>.
This method needs to work recursively.
substituteParams in class TypeReferencepublic GeneratedAnnotationUse annotate(Class<? extends Annotation> clazz)
annotate in interface Annotableclazz - The annotation class to annotate the class withpublic GeneratedAnnotationUse annotate(TypeReference clazz)
annotate in interface Annotableclazz - The annotation class to annotate the class withpublic <W extends AnnotationWriter> W annotate2(Class<W> clazz)
Annotable
annotate2 in interface Annotablepublic Collection<GeneratedAnnotationUse> annotations()
Annotable.annotations()
annotations in interface Annotablepublic Modifiers mods()
public GeneratedMethod setter(GeneratedField field)
field - Field for which a setter method needs to be build
public GeneratedMethod setterOverride(GeneratedField field)
public GeneratedMethod getter(GeneratedField field)
field - Field for which a getter method needs to be build
public List<GeneratedClass> superclasses()
GeneratedClass that inherit from this one
public GeneratedClass topLevelClass()
throws IllegalArgumentException
IllegalArgumentExceptionpublic String toString()
toString in class TypeReferencepublic boolean implementsClass(Class clazz)
public GeneratedField muleContextField()
public GeneratedField flowConstructField()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||