Package org.eclipse.jdt.core.dom

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


        this.buffer.append(" ");//$NON-NLS-1$
      }
      if (!node.superInterfaceTypes().isEmpty()) {
        this.buffer.append(node.isInterface() ? "extends " : "implements ");//$NON-NLS-2$//$NON-NLS-1$
        for (Iterator it = node.superInterfaceTypes().iterator(); it.hasNext(); ) {
          Type t = (Type) it.next();
          t.accept(this);
          if (it.hasNext()) {
            this.buffer.append(", ");//$NON-NLS-1$
          }
        }
        this.buffer.append(" ");//$NON-NLS-1$
View Full Code Here


  public boolean visit(TypeParameter node) {
    node.getName().accept(this);
    if (!node.typeBounds().isEmpty()) {
      this.buffer.append(" extends ");//$NON-NLS-1$
      for (Iterator it = node.typeBounds().iterator(); it.hasNext(); ) {
        Type t = (Type) it.next();
        t.accept(this);
        if (it.hasNext()) {
          this.buffer.append(" & ");//$NON-NLS-1$
        }
      }
    }
View Full Code Here

   * @see ASTVisitor#visit(UnionType)
   * @since 3.7
   */
  public boolean visit(UnionType node) {
    for (Iterator it = node.types().iterator(); it.hasNext(); ) {
      Type t = (Type) it.next();
      t.accept(this);
      if (it.hasNext()) {
        this.buffer.append('|');
      }
    }
    return false;
View Full Code Here

   * @see ASTVisitor#visit(WildcardType)
   * @since 3.1
   */
  public boolean visit(WildcardType node) {
    this.buffer.append("?");//$NON-NLS-1$
    Type bound = node.getBound();
    if (bound != null) {
      if (node.isUpperBound()) {
        this.buffer.append(" extends ");//$NON-NLS-1$
      } else {
        this.buffer.append(" super ");//$NON-NLS-1$
      }
      bound.accept(this);
    }
    return false;
  }
View Full Code Here

        while (iterator.hasNext()) {
          if (!isFirst)
            buffer.append(',');
          else
            isFirst = false;
          Type typeArgument = (Type) iterator.next();
          getFullyQualifiedName(typeArgument, buffer);
        }
        buffer.append('>');
        break;
      case ASTNode.PRIMITIVE_TYPE:
        buffer.append(((PrimitiveType) type).getPrimitiveTypeCode().toString());
        break;
      case ASTNode.QUALIFIED_TYPE:
        buffer.append(((QualifiedType) type).getName().getFullyQualifiedName());
        break;
      case ASTNode.SIMPLE_TYPE:
        buffer.append(((SimpleType) type).getName().getFullyQualifiedName());
        break;
      case ASTNode.WILDCARD_TYPE:
        buffer.append('?');
        WildcardType wildcardType = (WildcardType) type;
        Type bound = wildcardType.getBound();
        if (bound == null) return;
        if (wildcardType.isUpperBound()) {
          buffer.append(" extends "); //$NON-NLS-1$
        } else {
          buffer.append(" super "); //$NON-NLS-1$
View Full Code Here

        } else {
            privilegedActionName = ast.newName(PrivilegedAction.class.getName());
        }
        SimpleType rawPrivilegedActionType = ast.newSimpleType(privilegedActionName);
        ParameterizedType privilegedActionType = ast.newParameterizedType(rawPrivilegedActionType);
        Type typeArgument = (Type) rewrite.createCopyTarget(classLoaderCreation.getType());
        List<Type> typeArguments = checkedList(privilegedActionType.typeArguments());

        typeArguments.add(typeArgument);

        return privilegedActionType;
View Full Code Here

    private MethodDeclaration createRunMethodDeclaration(ASTRewrite rewrite, ClassInstanceCreation classLoaderCreation) {
        AST ast = rewrite.getAST();

        MethodDeclaration methodDeclaration = ast.newMethodDeclaration();
        SimpleName methodName = ast.newSimpleName("run");
        Type returnType = (Type) rewrite.createCopyTarget(classLoaderCreation.getType());
        Block methodBody = createRunMethodBody(rewrite, classLoaderCreation);
        List<Modifier> modifiers = checkedList(methodDeclaration.modifiers());

        modifiers.add(ast.newModifier(PUBLIC_KEYWORD));
        methodDeclaration.setName(methodName);
View Full Code Here

    this.newCompilationUnit = newCompilationUnit;
    this.oldCompilationUnit = oldCompilationUnit;
  }
  @Override
  public boolean visit(TypeDeclaration node) {
    Type superType = node.getSuperclassType();
//    System.out.println("Class: " + node.getName() + " extends " + ((superType == null) ? "Object" : superType));
   
    String superTypeName = "";
    if (superType == null){
      superTypeName = "BaseModel";
    } else {
      superTypeName = superType.toString();
    }
    /*
     * build the new class using AST
     */
    TypeDeclaration newType = ast.newTypeDeclaration();
View Full Code Here

    MethodDeclaration toGXTmethod = ast.newMethodDeclaration();
    toGXTmethod.setConstructor(false);
    List modifiers = toGXTmethod.modifiers();
    modifiers.add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
    toGXTmethod.setName(ast.newSimpleName("toGXTModelBean"));
    Type returnType = ast.newSimpleType(ast.newName(newType));
    toGXTmethod.setReturnType2(returnType);
    /*
     * method body starting with the block
     */
    org.eclipse.jdt.core.dom.Block block = ast.newBlock();
    /*
     * define the return value
     */
    SimpleName returnValueName = ast.newSimpleName("newGXTBean");
    VariableDeclarationFragment fragment = ast.newVariableDeclarationFragment();
    fragment.setName(returnValueName);
    ClassInstanceCreation newClassInstance = ast.newClassInstanceCreation();
    newClassInstance.setType((Type)returnType.copySubtree(ast, returnType));
    fragment.setInitializer(newClassInstance);
    VariableDeclarationStatement returnValue = ast.newVariableDeclarationStatement(fragment);
    returnValue.setType((Type)returnType.copySubtree(ast, returnType));
    block.statements().add(returnValue);
    /*
     * call each get method in the original and pass the result to the new set method
     *
     */
 
View Full Code Here

  }

  private void updateMethod(boolean shouldUseGenerics, AST ast, Object currDeclaration) {
    // Make return type void
    MethodDeclaration aMethod = (MethodDeclaration) currDeclaration;
    Type returnType = aMethod.getReturnType2();
    aMethod.setReturnType2(ast.newPrimitiveType(PrimitiveType.VOID));

    // Add AsyncCallback parameter
    SingleVariableDeclaration asyncCallbackParam = ast.newSingleVariableDeclaration();
    asyncCallbackParam.setName(ast.newSimpleName("callback")); //$NON-NLS-1$

    Type asyncCallbackType;
    if (shouldUseGenerics)
      asyncCallbackType = createAsyncCallbackType(ast, returnType);
    else
      asyncCallbackType = ast.newSimpleType(ast.newName("AsyncCallback")); //$NON-NLS-1$
View Full Code Here

TOP

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

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.