Interface MutableExecutableDeclaration

    • Method Detail

      • 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 this 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.
        Parameters:
        body - the expression to set as the body of this executable
      • setBody

        void setBody​(CompilationStrategy compilationStrategy)
        Sets the given 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.
        Parameters:
        compilationStrategy - the compilation strategy, must not be null
        Throws:
        java.lang.IllegalArgumentException - if compilationStrategy is null
      • setBody

        void setBody​(org.eclipse.xtend2.lib.StringConcatenationClient compilationTemplate)
        Sets the given 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.
        Parameters:
        compilationTemplate - the compilation strategy, must not be null
        Throws:
        java.lang.IllegalArgumentException - if compilationStrategy is null
      • setExceptions

        void setExceptions​(TypeReference... exceptions)
        Sets the declared exceptions.
        Parameters:
        exceptions - the declared exceptions
        Throws:
        java.lang.IllegalArgumentException - if the exceptions is null or contains null
      • addParameter

        MutableParameterDeclaration addParameter​(java.lang.String name,
                                                 TypeReference type)
        Adds a parameter
        Parameters:
        name - the name of the parameter, must be a valid java identifier
        type - the type of the parameter, must not be null
        Returns:
        the created parameter
        Throws:
        java.lang.IllegalArgumentException - if the name is not a valid java identifier or the type is null