Package org.eclipse.jdt.core.dom

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


    return true;
  }

  public boolean visit(MethodDeclaration node) {
    if (node.getName().getStartPosition() == this.loc) {
      final SingleVariableDeclaration svd = (SingleVariableDeclaration) node
          .parameters().get(this.paramNumber);

      final IJavaElement elem = svd.resolveBinding().getJavaElement();
      if (elem.isReadOnly() || svd.getName().resolveBoxing())
        throw new DefinitelyNotEnumerizableException(
            Messages.ASTNodeProcessor_SourceNotPresent, svd);
      if (svd.resolveBinding().getType().isEqualTo(
          node.getAST().resolveWellKnownType("java.lang.Object"))) //$NON-NLS-1$
        throw new NonEnumerizableASTException(Messages.ASTNodeProcessor_IllegalArrayUpcast,
            svd);
      this.elements.add(elem);
    }
View Full Code Here


     */
    protected void initDataType() {
        //        if (getDataType() == null) {
        Type declType = null;
        if (getASTNode() instanceof SingleVariableDeclaration) {
            SingleVariableDeclaration singleVarDecl = (SingleVariableDeclaration) getASTNode();
            declType = singleVarDecl.getType();
        } else {
            ASTNode parentNode = getASTNode().getParent();
            if (parentNode instanceof VariableDeclarationExpression) {
                VariableDeclarationExpression varDeclExpression = (VariableDeclarationExpression) parentNode;
                declType = varDeclExpression.getType();
View Full Code Here

        }
        lMethodID.append(AbstractFamixEntity.METHOD_START_BRACE);

        List<SingleVariableDeclaration> parameters = getASTNode().parameters();
        for (int i = 0; i < parameters.size(); i++) {
            SingleVariableDeclaration parameter = parameters.get(i);
            IVariableBinding lVariableBinding = parameter.resolveBinding();
            if (lVariableBinding != null) {
                lMethodID.append(convertParameterTypeBindingForMethodSignature(lVariableBinding.getType()));
            } else {
                lMethodID.append(convertParameterTypeForMethodSignature(parameter));
            }
View Full Code Here

    }
   
   
    List<?> parameters = node.parameters();
    for(int i = 0; i < parameters.size(); i++){
      SingleVariableDeclaration svd = (SingleVariableDeclaration) parameters.get(i);
      Type paramType = svd.getType();
           
      String encodedParamQualifier = encodedCallableQualifier + '/' + VisitorUtil.encode(VisitorUtil.identifierFor(svd));
      MethodParameterHandle paramHandle = callableHandle.addParameter(encodedParamQualifier, VisitorUtil.identifierFor(svd), VisitorUtil.identifierFor(paramType), new SourceCodeLocationHelper(cu, svd));
      AbstractTypeHandle paramTypeHandle = model.getTypeHandleFor(VisitorUtil.resolveAndEncode(paramType), VisitorUtil.identifierFor(paramType), VisitorUtil.isInterface(paramType));
      paramHandle.setType(paramTypeHandle);
View Full Code Here

              ParameterizedType parameterizedType = ast.newParameterizedType(callbackType);
              DomGenerics.typeArguments(parameterizedType).add(objectReturnType);
              callbackType = parameterizedType;
            }
            // prepare "callback" parameter
            SingleVariableDeclaration asyncCallback = ast.newSingleVariableDeclaration();
            asyncCallback.setType(callbackType);
            asyncCallback.setName(ast.newSimpleName("callback"));
            // add "callback" parameter
            DomGenerics.parameters(methodDeclaration).add(asyncCallback);
          }
          // remove throws
          methodDeclaration.thrownExceptions().clear();
View Full Code Here

   * @return <code>true</code> if {@link MethodDeclaration} has required event type parameter.
   */
  private boolean isEventHandler(MethodDeclaration methodDeclaration) {
    List<SingleVariableDeclaration> parameters = DomGenerics.parameters(methodDeclaration);
    if (parameters.size() == 1) {
      SingleVariableDeclaration parameter = parameters.get(0);
      String parameterTypeName = AstNodeUtils.getFullyQualifiedName(parameter, false);
      return m_handler.getEventTypeName().equals(parameterTypeName);
    }
    return false;
  }
View Full Code Here

            addAllIncludedTypes(returnType, allReferences);
          }
         
          // look at all parameters...
          for (Object varObj : methDecl.parameters()) {
            SingleVariableDeclaration var = (SingleVariableDeclaration) varObj;
            addAllIncludedTypes(var.getType(), allReferences);
          }
        }
       
        fields = resource.getTypedNodeList(node, ASTNode.CLASS_INSTANCE_CREATION, true);
        for (Object classCreationObj : fields) {
View Full Code Here

*/
@Test
public class MetaParameterTest {

  public void from_ast() {
    SingleVariableDeclaration ast = SingleVariableDeclarationFake.SOURCE_FILE_THAT;
    ParameterInfo res = ParameterInfoPojo.of(ast);
    assertThat(res, isEqualTo(ParameterInfoFake.SOURCE_FILE_THAT));
  }
View Full Code Here

    MethodDeclaration md = ast.newMethodDeclaration();
    md.modifiers().add(ast.newModifier(ModifierKeyword.PUBLIC_KEYWORD));
    md.setName(ast.newSimpleName("bar"));

    SingleVariableDeclaration var = ast.newSingleVariableDeclaration();
    var.setType(ast.newSimpleType(ast.newSimpleName("String")));
    var.setName(ast.newSimpleName("a"));
    md.parameters().add(var);
    td.bodyDeclarations().add(md);

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

    constructor.setName(ast.newSimpleName(clazz.getName()));
    constructor.modifiers().add(
        ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));

    for (int index = 0; index < varTypes.length; index++) {
      SingleVariableDeclaration variableDeclaration = ast
          .newSingleVariableDeclaration();
      variableDeclaration.setType(ast.newSimpleType(ast
          .newSimpleName(varTypes[index])));
      variableDeclaration.setName(ast.newSimpleName(varNames[index]));
      constructor.parameters().add(variableDeclaration);
    }

    Block block = ast.newBlock();
    SuperConstructorInvocation constructorInvocation = ast
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.