Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.ReturnStatement


        if (!isInterface) {
            // The body, just to return the checkpoint object.
            Block body = ast.newBlock();
            method.setBody(body);

            ReturnStatement returnStatement = ast.newReturnStatement();
            returnStatement.setExpression(ast.newSimpleName(CHECKPOINT_NAME));
            body.statements().add(returnStatement);
        }

        method.modifiers().add(
                ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
View Full Code Here


        invocation = ast.newMethodInvocation();
        invocation
                .setName(ast.newSimpleName(_getGetCheckpointMethodName(true)));
        body = ast.newBlock();

        ReturnStatement returnStatement = ast.newReturnStatement();
        returnStatement.setExpression(invocation);
        body.statements().add(returnStatement);
        getCheckpoint.setBody(body);

        getCheckpoint.modifiers().add(
                ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
        getCheckpoint.modifiers().add(
                ast.newModifier(Modifier.ModifierKeyword.FINAL_KEYWORD));
        classDeclaration.bodyDeclarations().add(getCheckpoint);

        // Add a set checkpoint method.
        MethodDeclaration setCheckpoint = ast.newMethodDeclaration();
        setCheckpoint.setName(ast
                .newSimpleName(_getSetCheckpointMethodName(false)));
        setCheckpoint.setReturnType2(createType(ast, getClassName(Object.class,
                state, root)));

        // Add a single checkpoint parameter.
        SingleVariableDeclaration checkpoint = ast
                .newSingleVariableDeclaration();
        checkpoint.setType(createType(ast, checkpointType));
        checkpoint.setName(ast.newSimpleName("checkpoint"));
        setCheckpoint.parameters().add(checkpoint);

        // Add a call to the setcheckpoint method in the enclosing anonymous
        // class.
        invocation = ast.newMethodInvocation();
        invocation
                .setName(ast.newSimpleName(_getSetCheckpointMethodName(true)));
        invocation.arguments().add(ast.newSimpleName("checkpoint"));

        // Return this object.
        returnStatement = ast.newReturnStatement();
        returnStatement.setExpression(ast.newThisExpression());

        body = ast.newBlock();
        body.statements().add(ast.newExpressionStatement(invocation));
        body.statements().add(returnStatement);
        setCheckpoint.setBody(body);
View Full Code Here

                    _createRollbackableObject(ast, isAnonymous));
            thenBranch.statements().add(
                    ast.newExpressionStatement(addInvocation));

            // Return this object.
            ReturnStatement returnStatement = ast.newReturnStatement();
            returnStatement.setExpression(ast.newThisExpression());
            body.statements().add(returnStatement);
        }

        method.modifiers().add(
                ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
View Full Code Here

                  nextCU.getLineNumber(e.getStartPosition()),
                  methodDeclaration, callDL, HistoryDefinitionLocation.RETURN);
            } else {
              Collection/*<ReturnStatement>*/ returns = CallerFinder.findReturns(monitor, methodDeclaration, null);
              for (Iterator iter2 = returns.iterator(); iter2.hasNext();) {
                ReturnStatement returnStmt = (ReturnStatement) iter2.next();
             
                HistoryDefinitionLocation dl = new HistoryDefinitionLocation(
                    returnStmt.toString(),
                    nextResource,
                    nextCU.getLineNumber(returnStmt.getStartPosition()),
                    returnStmt, callDL, HistoryDefinitionLocation.RETURN);
                if(registerExpansion(dl)) {
                  Expression expr = returnStmt.getExpression();
                  if(expr != null) {
                    // Recurse on the returned expression
                    stack.addLast(mi);
                    processExpression(dl, expr, nextCU, nextResource, stack, monitor, HistoryDefinitionLocation.COPY,false);
                    stack.removeLast();
View Full Code Here

      this.process(sc.getParent());
      break;
    }

    case ASTNode.RETURN_STATEMENT: {
      final ReturnStatement rs = (ReturnStatement) node;

      // process what is being returned.
      this.processExpression(rs.getExpression());

      // Get the corresponding method declaration.
      final MethodDeclaration methDecl = Util.getMethodDeclaration(rs);

      // Get the corresponding method.
View Full Code Here

      methodDeclaration.modifiers().add(
          ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));

      // Content of getter method
      Block block = ast.newBlock();
      ReturnStatement returnStatement = ast.newReturnStatement();
      SimpleName simpleName = ast.newSimpleName(property.getName());
      returnStatement.setExpression(simpleName);
      block.statements().add(returnStatement);
      methodDeclaration.setBody(block);
    }
  }
View Full Code Here

        methodDeclaration.setReturnType2(ast
            .newPrimitiveType(PrimitiveType.LONG));

        String body = bodyRel.get(method).get(0);
        ReturnStatement returnStatement = ast.newReturnStatement();
        returnStatement.setExpression(getMethodBody(body, classId));
        methodDeclaration.setBody(ast.newBlock());
        methodDeclaration.getBody().statements().add(returnStatement);

        result.add(methodDeclaration);
      }
View Full Code Here

      MethodInvocation pmi = ast.newMethodInvocation();
      pmi.setName(ast.newSimpleName(parameterMethod.getName().getFullyQualifiedName()));
      mi.arguments().add(pmi);

      // Create the return statement
      ReturnStatement returnStatement = ast.newReturnStatement();
      returnStatement.setExpression(mi);

      Block block = ast.newBlock();
      block.statements().add(returnStatement);
      md.setBody(block);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.ReturnStatement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.