Package org.eclipse.jdt.core.dom

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


                    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
                                .get(i);
                        SingleVariableDeclaration param2i = (SingleVariableDeclaration) parameters2
                                .get(i);
                        int paramResult = buildSignature(param1i.getType())
                                .compareTo(buildSignature(param2i.getType()));
                        if (paramResult != 0) {
                            return paramResult;
                        }
                    }
                    if (length1 != length2) {
View Full Code Here


        } else if (arg instanceof SimpleName) {
            SimpleName name = (SimpleName) arg;
            // System.err.println("TODO -> Name: " + name);
            VariableDeclaration varDecl = LapseView.name2decl(name, unit, resource);
            if (varDecl instanceof SingleVariableDeclaration) {
                SingleVariableDeclaration decl = (SingleVariableDeclaration) varDecl;
                if (decl.getInitializer() != null && decl.getInitializer() instanceof StringLiteral) {
                    StringLiteral l = (StringLiteral) decl.getInitializer();
                    return true;
                }
            } else {
                VariableDeclarationFragment decl = (VariableDeclarationFragment) varDecl;
                if (decl.getInitializer() != null) {
                    return isStringContant(decl.getInitializer(), unit, resource);
                }
            }
        } else if (arg instanceof MethodInvocation) {
            MethodInvocation inv = (MethodInvocation) arg;
            if (inv.getName().getIdentifier().equals("toString")) {
View Full Code Here

        } else if (arg instanceof SimpleName) {
            SimpleName name = (SimpleName) arg;
            // System.err.println("TODO -> Name: " + name);
            VariableDeclaration varDecl = LapseView.name2decl(name, unit, resource);
            if (varDecl instanceof SingleVariableDeclaration) {
                SingleVariableDeclaration decl = (SingleVariableDeclaration) varDecl;
                if (decl.getInitializer() != null && decl.getInitializer() instanceof StringLiteral) {
                    StringLiteral l = (StringLiteral) decl.getInitializer();
                    return true;
                }
            } else {
                VariableDeclarationFragment decl = (VariableDeclarationFragment) varDecl;
                if (decl.getInitializer() != null) {
                    return isStringContant(decl.getInitializer(), unit, resource);
                }
            }
        } else if (arg instanceof MethodInvocation) {
            MethodInvocation inv = (MethodInvocation) arg;
            if (inv.getName().getIdentifier().equals("toString")) {
View Full Code Here

      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$
      }

      Block block = JDTUtils.parseBlock(code);
      block = (Block) ASTNode.copySubtree(methodDeclaration.getAST(), block);
View Full Code Here

    if (signature.length != method.parameters().size()) {
      return false;
    }

    for (int i = 0; i < signature.length; i++) {
      SingleVariableDeclaration var = (SingleVariableDeclaration) method.parameters().get(i);
      Type type = var.getType();

      ITypeBinding typeBinding = type.resolveBinding();

      if (!(typeBinding.getQualifiedName().toString().equals(signature[i]))) {
        return false;
View Full Code Here

  private String[] getSignature(MethodDeclaration methodDeclaration) {
    List<String> params = new ArrayList<String>();
   
    for (int i = 0; i < methodDeclaration.parameters().size(); i++) {
      SingleVariableDeclaration var = (SingleVariableDeclaration) methodDeclaration.parameters().get(i);
      Type type = var.getType();

      ITypeBinding typeBinding = type.resolveBinding();
      String param = typeBinding.getQualifiedName().toString();
      params.add(param);
    }
View Full Code Here

    return this;
  }

  @Override
  public SingleVariableDeclaration toSingleVariableDeclaration(AST ast) {
    SingleVariableDeclaration declaration = ast.newSingleVariableDeclaration();

    Type type = simpleTypeInfo.toType(ast);
    declaration.setType(type);

    SimpleName variableName = ast.newSimpleName(name);
    declaration.setName(variableName);

    return declaration;
  }
View Full Code Here

    accessInfo.writeTo(method);
    return this;
  }

  public MethodDeclarationWriter addParameter(TypeInfo typeInfo) {
    SingleVariableDeclaration svd = typeInfo.toSingleVariableDeclaration(ast);
    method.parameters().add(svd);
    return this;
  }
View Full Code Here

    return ast.newSimpleType(name);
  }

  @Override
  public SingleVariableDeclaration toSingleVariableDeclaration(AST ast) {
    SingleVariableDeclaration declaration = ast.newSingleVariableDeclaration();
    declaration.setType(toType(ast));

    String variableName = WayCode.lowerCaseFirstChar(name);
    declaration.setName(ast.newSimpleName(variableName));

    return declaration;
  }
View Full Code Here

      break;
    }

    case ASTNode.SINGLE_VARIABLE_DECLARATION: {
      // its a formal parameter.
      final SingleVariableDeclaration svd = (SingleVariableDeclaration) node;
      // take care of local usage.
      final IJavaElement elem = svd.resolveBinding().getJavaElement();

      if (elem.isReadOnly() || svd.getName().resolveBoxing())
        throw new DefinitelyNotEnumerizableException(
            Messages.ASTNodeProcessor_SourceNotPresent, node);
      if (svd.resolveBinding().getType().isEqualTo(
          node.getAST().resolveWellKnownType("java.lang.Object"))) //$NON-NLS-1$
        throw new NonEnumerizableASTException(Messages.ASTNodeProcessor_IllegalArrayUpcast,
            svd);

      this.found.add(elem);
View Full Code Here

TOP

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

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.