@Beta public interface MutableExecutableDeclaration extends MutableTypeParameterDeclarator, ExecutableDeclaration
Modifier and Type | Method and Description |
---|---|
MutableParameterDeclaration |
addParameter(java.lang.String name,
TypeReference type)
Adds a parameter
|
java.lang.Iterable<? extends MutableParameterDeclaration> |
getParameters() |
void |
setBody(CompilationStrategy compilationStrategy)
Sets the given
CompilationStrategy as the body. |
void |
setBody(Expression body)
Setting an expression will alter the scope of it accordingly.
|
void |
setBody(StringConcatenationClient compilationTemplate)
Sets the given
StringConcatenationClient as the body. |
void |
setExceptions(TypeReference... exceptions)
Sets the declared exceptions.
|
void |
setVarArgs(boolean isVarArgs) |
addTypeParameter, getTypeParameters
getDeclaringType, setDeprecated, setDocComment, setVisibility
markAsRead
addAnnotation, removeAnnotation
setSimpleName
remove
getBody, getExceptions, isVarArgs
getDocComment, getModifiers, getVisibility, isDeprecated
findAnnotation, getAnnotations
getCompilationUnit, getSimpleName
java.lang.Iterable<? extends MutableParameterDeclaration> getParameters()
getParameters
in interface ExecutableDeclaration
void setVarArgs(boolean isVarArgs)
isVarArgs
- whether the last argument is a var arg.void setBody(Expression body)
MutableExecutableDeclaration
has already set
another expression or compilation strategy the old one will be detached.
If the given expression is already assigned to another MutableExecutableDeclaration
or MutableFieldDeclaration
it will be automatically detached from it.body
- the expression to set as the body of this executablevoid setBody(CompilationStrategy compilationStrategy)
CompilationStrategy
as the body.
The given CompilationStrategy
will be executed later during code generation, not immediately.
If this MutableExecutableDeclaration
has already set another expression or compilation strategy the old one will be detached.compilationStrategy
- the compilation strategy, must not be null
java.lang.IllegalArgumentException
- if compilationStrategy
is null
void setBody(StringConcatenationClient compilationTemplate)
StringConcatenationClient
as the body.
The given StringConcatenationClient
will be executed later during code generation, not immediately.
If this MutableExecutableDeclaration
has already set another expression or compilation strategy the old one will be detached.compilationTemplate
- the compilation strategy, must not be null
java.lang.IllegalArgumentException
- if compilationStrategy
is null
void setExceptions(TypeReference... exceptions)
exceptions
- the declared exceptionsjava.lang.IllegalArgumentException
- if the exceptions
is null
or contains null
MutableParameterDeclaration addParameter(java.lang.String name, TypeReference type)
name
- the name of the parameter, must be a valid java identifiertype
- the type of the parameter, must not be null
java.lang.IllegalArgumentException
- if the name is not a valid java identifier or the type is null