Interface MutableExecutableDeclaration
-
- All Superinterfaces:
AnnotationTarget,Declaration,Element,ExecutableDeclaration,MemberDeclaration,MutableAnnotationTarget,MutableDeclaration,MutableElement,MutableMemberDeclaration,MutableNamedElement,MutableTypeParameterDeclarator,NamedElement,TypeParameterDeclarator
- All Known Subinterfaces:
MutableConstructorDeclaration,MutableMethodDeclaration
@Beta public interface MutableExecutableDeclaration extends MutableTypeParameterDeclarator, ExecutableDeclaration
- Noimplement:
- This interface is not intended to be implemented by clients.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MutableParameterDeclarationaddParameter(java.lang.String name, TypeReference type)Adds a parameterjava.lang.Iterable<? extends MutableParameterDeclaration>getParameters()voidsetBody(CompilationStrategy compilationStrategy)Sets the givenCompilationStrategyas the body.voidsetBody(Expression body)Setting an expression will alter the scope of it accordingly.voidsetBody(org.eclipse.xtend2.lib.StringConcatenationClient compilationTemplate)Sets the givenStringConcatenationClientas the body.voidsetExceptions(TypeReference... exceptions)Sets the declared exceptions.voidsetVarArgs(boolean isVarArgs)-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.AnnotationTarget
findAnnotation, getAnnotations
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.ExecutableDeclaration
getBody, getExceptions, isVarArgs
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MemberDeclaration
getDocComment, getModifiers, getVisibility, isDeprecated
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableAnnotationTarget
addAnnotation, removeAnnotation
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableDeclaration
markAsRead
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableElement
remove
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableMemberDeclaration
getDeclaringType, setDeprecated, setDocComment, setVisibility
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableNamedElement
setSimpleName
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableTypeParameterDeclarator
addTypeParameter, getTypeParameters
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.NamedElement
getCompilationUnit, getSimpleName
-
-
-
-
Method Detail
-
getParameters
java.lang.Iterable<? extends MutableParameterDeclaration> getParameters()
- Specified by:
getParametersin interfaceExecutableDeclaration- Returns:
- the declared parameters
-
setVarArgs
void setVarArgs(boolean isVarArgs)
- Parameters:
isVarArgs- whether the last argument is a var arg.
-
setBody
void setBody(Expression body)
Setting an expression will alter the scope of it accordingly. Each expression can only be assigned to one element, if thisMutableExecutableDeclarationhas already set another expression or compilation strategy the old one will be detached. If the given expression is already assigned to anotherMutableExecutableDeclarationorMutableFieldDeclarationit will be automatically detached from it.- Parameters:
body- the expression to set as the body of this executable
-
setBody
void setBody(CompilationStrategy compilationStrategy)
Sets the givenCompilationStrategyas the body. The givenCompilationStrategywill be executed later during code generation, not immediately. If thisMutableExecutableDeclarationhas already set another expression or compilation strategy the old one will be detached.- Parameters:
compilationStrategy- the compilation strategy, must not benull- Throws:
java.lang.IllegalArgumentException- ifcompilationStrategyisnull
-
setBody
void setBody(org.eclipse.xtend2.lib.StringConcatenationClient compilationTemplate)
Sets the givenStringConcatenationClientas the body. The givenStringConcatenationClientwill be executed later during code generation, not immediately. If thisMutableExecutableDeclarationhas already set another expression or compilation strategy the old one will be detached.- Parameters:
compilationTemplate- the compilation strategy, must not benull- Throws:
java.lang.IllegalArgumentException- ifcompilationStrategyisnull
-
setExceptions
void setExceptions(TypeReference... exceptions)
Sets the declared exceptions.- Parameters:
exceptions- the declared exceptions- Throws:
java.lang.IllegalArgumentException- if theexceptionsisnullor containsnull
-
addParameter
MutableParameterDeclaration addParameter(java.lang.String name, TypeReference type)
Adds a parameter- Parameters:
name- the name of the parameter, must be a valid java identifiertype- the type of the parameter, must not benull- Returns:
- the created parameter
- Throws:
java.lang.IllegalArgumentException- if the name is not a valid java identifier or the type isnull
-
-