public class GeneratedClass extends TypeReference implements Declaration, ClassContainer, Generifiable, Annotable, Documentable
TypeReference
.
method(int, Type, String)
and field(int, Type, String)
.Modifier and Type | Field and Description |
---|---|
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 |
EMPTY_ARRAY
Modifier and Type | Method and Description |
---|---|
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
|
<W extends AnnotationWriter> |
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()
|
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.
|
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
compareTo, dotclass, elementType, equals, hashCode, isArray, isPrimitive, isReference, parse
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
owner
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
public final boolean isAnonymous()
public GeneratedClass _extends(TypeReference superClass)
superClass
- Superclass for this classpublic GeneratedClass _extends(Class<?> superClass)
public TypeReference _extends()
_extends
in class TypeReference
TypeReference
.
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 implementspublic GeneratedClass _implements(Class<?> iface)
public Iterator<TypeReference> _implements()
_implements
in class TypeReference
TypeReference
objects that represents those interfaces
implemented by this object.public String name()
java.util.List
, this method
returns "List"
"name
in class TypeReference
public EnumConstant enumConstant(String name)
name
- The name of the constant.public String fullName()
public String binaryName()
Type
binaryName
in class Type
public boolean isInterface()
TypeReference
isInterface
in class TypeReference
public 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 fieldpublic 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 ClassContainer
name
- Name of the annotation Type declaration to be added to this packageClassAlreadyExistsException
- When the specified class/interface was already created.public GeneratedClass _enum(String name) throws ClassAlreadyExistsException
_enum
in interface ClassContainer
name
- Name of the enum to be added to this packageClassAlreadyExistsException
- 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 declarationClassAlreadyExistsException
- 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 methodpublic 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 ClassContainer
public boolean isPackage()
ClassContainer
isPackage
in interface ClassContainer
public GeneratedPackage getPackage()
ClassContainer
getPackage
in interface ClassContainer
public GeneratedClass _class(int mods, String name) throws ClassAlreadyExistsException
_class
in interface ClassContainer
mods
- Modifiers for this class declarationname
- Name of class to be added to this packageClassAlreadyExistsException
- When the specified class/interface was already created.public GeneratedClass _class(int mods, String name, boolean isInterface) throws ClassAlreadyExistsException
_class
in interface ClassContainer
ClassAlreadyExistsException
public GeneratedClass _class(int mods, String name, GeneratedClassType classTypeVal) throws ClassAlreadyExistsException
ClassContainer
_class
in interface ClassContainer
ClassAlreadyExistsException
public GeneratedClass _class(String name)
_class
in interface ClassContainer
public GeneratedClass _interface(int mods, String name) throws ClassAlreadyExistsException
_interface
in interface ClassContainer
mods
- Modifiers for this interface declarationname
- Name of interface to be added to this packageClassAlreadyExistsException
- When the specified class/interface was already created.public GeneratedClass _interface(String name) throws ClassAlreadyExistsException
_interface
in interface ClassContainer
ClassAlreadyExistsException
- When the specified class/interface was already created.public GeneratedJavaDocComment javadoc()
javadoc
in interface Documentable
public void hide()
public boolean isHidden()
public final Iterator<GeneratedClass> classes()
classes
in interface ClassContainer
public final TypeReference[] listClasses()
public TypeReference outer()
TypeReference
outer
in class TypeReference
public void declare(Formatter f)
declare
in interface Declaration
protected void declareBody(Formatter f)
public void direct(String string)
public final GeneratedPackage _package()
TypeReference
_package
in class TypeReference
public final ClassContainer parentContainer()
ClassContainer
parentContainer
in interface ClassContainer
public 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 Generifiable
public TypeVariable[] typeParams()
TypeReference
TypeReference
represents
Set<T>
, this method returns an array
that contains single TypeVariable
for 'T'.typeParams
in interface Generifiable
typeParams
in class TypeReference
protected TypeReference substituteParams(TypeVariable[] variables, List<TypeReference> bindings)
TypeReference
TypeReference
for Map<String,Map<Integer>>
.
This method needs to work recursively.substituteParams
in class TypeReference
public GeneratedAnnotationUse annotate(Class<? extends Annotation> clazz)
public GeneratedAnnotationUse annotate(TypeReference clazz)
public <W extends AnnotationWriter> W annotate2(Class<W> clazz)
Annotable
public Collection<GeneratedAnnotationUse> annotations()
annotations
in interface Annotable
public Modifiers mods()
public GeneratedMethod setter(GeneratedField field)
field
- Field for which a setter method needs to be buildpublic GeneratedMethod setterOverride(GeneratedField field)
public GeneratedMethod getter(GeneratedField field)
field
- Field for which a getter method needs to be buildpublic List<GeneratedClass> superclasses()
GeneratedClass
that inherit from this onepublic GeneratedClass topLevelClass() throws IllegalArgumentException
IllegalArgumentException
public String toString()
toString
in class TypeReference
public boolean implementsClass(Class clazz)
public GeneratedField muleContextField()
public GeneratedField flowConstructField()
Copyright © 2010–2015 MuleSoft, Inc.. All rights reserved.