Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.MethodDeclaration.parameters()


        // Add two parameters.
        SingleVariableDeclaration timestamp = ast
                .newSingleVariableDeclaration();
        timestamp.setType(ast.newPrimitiveType(PrimitiveType.LONG));
        timestamp.setName(ast.newSimpleName("timestamp"));
        commit.parameters().add(timestamp);

        // Add a call to the restore method in the enclosing anonymous class.
        MethodInvocation invocation = ast.newMethodInvocation();
        invocation.setName(ast.newSimpleName(_getCommitMethodName(true)));
        invocation.arguments().add(ast.newSimpleName("timestamp"));
View Full Code Here


        // Add two parameters.
        timestamp = ast.newSingleVariableDeclaration();
        timestamp.setType(ast.newPrimitiveType(PrimitiveType.LONG));
        timestamp.setName(ast.newSimpleName("timestamp"));
        restore.parameters().add(timestamp);

        SingleVariableDeclaration trim = ast.newSingleVariableDeclaration();
        trim.setType(ast.newPrimitiveType(PrimitiveType.BOOLEAN));
        trim.setName(ast.newSimpleName("trim"));
        restore.parameters().add(trim);
View Full Code Here

        restore.parameters().add(timestamp);

        SingleVariableDeclaration trim = ast.newSingleVariableDeclaration();
        trim.setType(ast.newPrimitiveType(PrimitiveType.BOOLEAN));
        trim.setName(ast.newSimpleName("trim"));
        restore.parameters().add(trim);

        // Add a call to the restore method in the enclosing anonymous class.
        invocation = ast.newMethodInvocation();
        invocation.setName(ast.newSimpleName(_getRestoreMethodName(true)));
        invocation.arguments().add(ast.newSimpleName("timestamp"));
View Full Code Here

        // 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
View Full Code Here

        // Add a timestamp parameter.
        SingleVariableDeclaration timestamp = ast
                .newSingleVariableDeclaration();
        timestamp.setType(ast.newPrimitiveType(PrimitiveType.LONG));
        timestamp.setName(ast.newSimpleName("timestamp"));
        method.parameters().add(timestamp);

        // Add a trim parameter.
        SingleVariableDeclaration trim = ast.newSingleVariableDeclaration();
        trim.setType(ast.newPrimitiveType(PrimitiveType.BOOLEAN));
        trim.setName(ast.newSimpleName("trim"));
View Full Code Here

        // Add a trim parameter.
        SingleVariableDeclaration trim = ast.newSingleVariableDeclaration();
        trim.setType(ast.newPrimitiveType(PrimitiveType.BOOLEAN));
        trim.setName(ast.newSimpleName("trim"));
        method.parameters().add(trim);

        // Return type default to "void".
        if (!isInterface) {
            // The method body.
            Block body = ast.newBlock();
View Full Code Here

                        return nameResult;
                    }

                    // if names equal, sort by parameter types
                    List<?> parameters1 = method1.parameters();
                    List<?> parameters2 = method2.parameters();
                    int length1 = parameters1.size();
                    int length2 = parameters2.size();
                    int minLength = Math.min(length1, length2);
                    for (int i = 0; i < minLength; i++) {
                        SingleVariableDeclaration param1i = (SingleVariableDeclaration) parameters1
View Full Code Here

      assert source instanceof MethodMetric : "The calculation is set on method";
      MethodDeclaration astNode = (MethodDeclaration) source.getASTNode();
      if (null == astNode)
        return;
      else
        values[0].setValue(astNode.parameters().size());
    }
  }

  @Override
  public void analyze(AbstractMetricElement source,
View Full Code Here

      TypeDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
      MethodDeclaration methodDeclaration = getMethodDeclaration(typeDeclaration, methodName, signature);
      removeAbstractModifier(methodDeclaration.modifiers());

      List parameters = methodDeclaration.parameters();
      for (int i = 0; i < parameters.size(); i++) {
        SingleVariableDeclaration parameter = (SingleVariableDeclaration) parameters.get(i);
        code = code.replaceAll("\\$\\{" + Integer.toString(i) + "\\}", parameter.resolveBinding().getName()); //$NON-NLS-1$ //$NON-NLS-2$
      }
View Full Code Here

    accessInfo.writeTo(method);
    returnTypeInfo.writeTo(ast, method);

    List<SingleVariableDeclaration> parameterDeclarationList;
    parameterDeclarationList = transform(parameterInfoList, new ParameterInfoToSingleVariableDeclaration(ast));
    method.parameters().addAll(parameterDeclarationList);

    return method;
  }

  @Override
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.