org.mule.devkit.model.code
Class GeneratedMethod

java.lang.Object
  extended by org.mule.devkit.model.code.GeneratedMethod
All Implemented Interfaces:
Annotable, Declaration, Documentable, Generifiable

public class GeneratedMethod
extends Object
implements Declaration, Annotable, Documentable

Java method.


Method Summary
 GeneratedMethod _throws(Class<? extends Throwable> exception)
           
 GeneratedMethod _throws(TypeReference exception)
          Add an exception to the list of exceptions that this method may throw.
 GeneratedAnnotationUse annotate(Class<? extends Annotation> clazz)
          Adds an annotation to this variable.
 GeneratedAnnotationUse annotate(TypeReference clazz)
          Adds an annotation to this variable.
<W extends AnnotationWriter>
W
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()
          Read-only live view of all annotations on this Annotable
 GeneratedBlock body()
          Get the block that makes up body of this method
 void declare(Formatter f)
           
 void declareDefaultValue(GeneratedExpression value)
          Specify the default value for this annotation member
 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.
 Modifiers getMods()
          Deprecated. use mods()
 boolean hasSignature(Type[] argTypes)
          Returns true if the method has the specified signature.
 boolean hasVarArgs()
          Check if there are any varargs declared for this method signature.
 GeneratedJavaDocComment javadoc()
          Creates, if necessary, and returns the class javadoc for this DefinedClass
 GeneratedVariable[] listParams()
          Returns all the parameters in an array.
 Type[] listParamTypes()
          Returns all the parameter types in an array.
 GeneratedVariable listVarParam()
          Returns the variable parameter
 Type listVarParamType()
          Returns the varags parameter type.
 Modifiers mods()
           
 String name()
           
 void name(String n)
          Changes the name of the method.
protected  CodeModel owner()
           
 GeneratedVariable param(Class<?> type, String name)
           
 GeneratedVariable param(int mods, Class<?> type, String name)
           
 GeneratedVariable param(int mods, Type type, String name)
          Add the specified variable to the list of parameters for this method signature.
 GeneratedVariable param(Type type, String name)
           
 List<GeneratedVariable> params()
          Returns the list of variable of this method.
 Type type()
          Returns the return type.
 void type(Type t)
          Overrides the return type.
 TypeVariable[] typeParams()
          Iterates all the type parameters of this class/interface.
 GeneratedVariable varParam(Class<?> type, String name)
           
 GeneratedVariable varParam(Type type, String name)
          Add the specified variable argument to the list of parameters for this method signature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

_throws

public GeneratedMethod _throws(TypeReference exception)
Add an exception to the list of exceptions that this method may throw.

Parameters:
exception - Name of an exception that this method may throw

_throws

public GeneratedMethod _throws(Class<? extends Throwable> exception)

params

public List<GeneratedVariable> params()
Returns the list of variable of this method.

Returns:
List of parameters of this method. This list is not modifiable.

param

public GeneratedVariable param(int mods,
                               Type type,
                               String name)
Add the specified variable to the list of parameters for this method signature.

Parameters:
type - Type of the parameter being added
name - Name of the parameter being added
Returns:
New parameter variable

param

public GeneratedVariable param(Type type,
                               String name)

param

public GeneratedVariable param(int mods,
                               Class<?> type,
                               String name)

param

public GeneratedVariable param(Class<?> type,
                               String name)

varParam

public GeneratedVariable varParam(Class<?> type,
                                  String name)
See Also:
varParam(Type, String)

varParam

public GeneratedVariable varParam(Type type,
                                  String name)
Add the specified variable argument to the list of parameters for this method signature.

Parameters:
type - Type of the parameter being added.
name - Name of the parameter being added
Returns:
the variable parameter
Throws:
IllegalStateException - If this method is called twice. varargs in J2SE 1.5 can appear only once in the method signature.

annotate

public GeneratedAnnotationUse annotate(TypeReference clazz)
Adds an annotation to this variable.

Specified by:
annotate in interface Annotable
Parameters:
clazz - The annotation class to annotate the field with

annotate

public GeneratedAnnotationUse annotate(Class<? extends Annotation> clazz)
Adds an annotation to this variable.

Specified by:
annotate in interface Annotable
Parameters:
clazz - The annotation class to annotate the field with

annotate2

public <W extends AnnotationWriter> W annotate2(Class<W> clazz)
Description copied from interface: Annotable
Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.

Specified by:
annotate2 in interface Annotable

annotations

public Collection<GeneratedAnnotationUse> annotations()
Description copied from interface: Annotable
Read-only live view of all annotations on this Annotable

Specified by:
annotations in interface Annotable
Returns:
Can be empty but never null.

hasVarArgs

public boolean hasVarArgs()
Check if there are any varargs declared for this method signature.


name

public String name()

name

public void name(String n)
Changes the name of the method.


type

public Type type()
Returns the return type.


type

public void type(Type t)
Overrides the return type.


listParamTypes

public Type[] listParamTypes()
Returns all the parameter types in an array.

Returns:
If there's no parameter, an empty array will be returned.

listVarParamType

public Type listVarParamType()
Returns the varags parameter type.

Returns:
If there's no vararg parameter type, null will be returned.

listParams

public GeneratedVariable[] listParams()
Returns all the parameters in an array.

Returns:
If there's no parameter, an empty array will be returned.

listVarParam

public GeneratedVariable listVarParam()
Returns the variable parameter

Returns:
If there's no parameter, null will be returned.

hasSignature

public boolean hasSignature(Type[] argTypes)
Returns true if the method has the specified signature.


body

public GeneratedBlock body()
Get the block that makes up body of this method

Returns:
Body of method

declareDefaultValue

public void declareDefaultValue(GeneratedExpression value)
Specify the default value for this annotation member

Parameters:
value - Default value for the annotation member

javadoc

public GeneratedJavaDocComment javadoc()
Creates, if necessary, and returns the class javadoc for this DefinedClass

Specified by:
javadoc in interface Documentable
Returns:
JDocComment containing javadocs for this class

declare

public void declare(Formatter f)
Specified by:
declare in interface Declaration

mods

public Modifiers mods()
Returns:
the current modifiers of this method. Always return non-null valid object.

getMods

public Modifiers getMods()
Deprecated. use mods()


owner

protected CodeModel owner()

generify

public TypeVariable generify(String name)
Description copied from interface: Generifiable
Adds a new type variable to this declaration.

Specified by:
generify in interface Generifiable

generify

public TypeVariable generify(String name,
                             Class<?> bound)
Description copied from interface: Generifiable
Adds a new type variable to this declaration with a bound.

Specified by:
generify in interface Generifiable

generify

public TypeVariable generify(String name,
                             TypeReference bound)
Description copied from interface: Generifiable
Adds a new type variable to this declaration with a bound.

Specified by:
generify in interface Generifiable

typeParams

public TypeVariable[] typeParams()
Description copied from interface: Generifiable
Iterates all the type parameters of this class/interface.

Specified by:
typeParams in interface Generifiable


Copyright © 2010-2013 MuleSoft, Inc.. All Rights Reserved.