public class GeneratedMethod extends Object implements Declaration, Annotable, Documentable
Modifier and Type | Method and Description |
---|---|
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> |
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.
|
public GeneratedMethod _throws(TypeReference exception)
exception
- Name of an exception that this method may throwpublic GeneratedMethod _throws(Class<? extends Throwable> exception)
public List<GeneratedVariable> params()
public GeneratedVariable param(int mods, Type type, String name)
type
- Type of the parameter being addedname
- Name of the parameter being addedpublic GeneratedVariable param(Type type, String name)
public GeneratedVariable param(int mods, Class<?> type, String name)
public GeneratedVariable param(Class<?> type, String name)
public GeneratedVariable varParam(Class<?> type, String name)
varParam(Type, String)
public GeneratedVariable varParam(Type type, String name)
type
- Type of the parameter being added.name
- Name of the parameter being addedIllegalStateException
- If this method is called twice.
varargs in J2SE 1.5 can appear only once in the
method signature.public GeneratedAnnotationUse annotate(TypeReference clazz)
public GeneratedAnnotationUse annotate(Class<? extends Annotation> clazz)
public <W extends AnnotationWriter> W annotate2(Class<W> clazz)
Annotable
public Collection<GeneratedAnnotationUse> annotations()
Annotable
Annotable
annotations
in interface Annotable
public boolean hasVarArgs()
public String name()
public void name(String n)
public Type type()
public void type(Type t)
public Type[] listParamTypes()
public Type listVarParamType()
public GeneratedVariable[] listParams()
public GeneratedVariable listVarParam()
public boolean hasSignature(Type[] argTypes)
public GeneratedBlock body()
public void declareDefaultValue(GeneratedExpression value)
value
- Default value for the annotation memberpublic GeneratedJavaDocComment javadoc()
javadoc
in interface Documentable
public void declare(Formatter f)
declare
in interface Declaration
public Modifiers mods()
protected CodeModel owner()
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()
Generifiable
typeParams
in interface Generifiable
Copyright © 2010–2015 MuleSoft, Inc.. All rights reserved.