Package org.eclipse.jdt.core.dom

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


    /**
     * Add inheritance associations with superclass.
     */
    private void handleClassExtension() {
        Type superType = getASTNode().getSuperclassType();
//        String nameFromBinding = "Object";
//        if ((getTypeBinding() != null) && (getTypeBinding().getSuperclass() != null)
//                && (getTypeBinding().getSuperclass().getName() != null)) {
//            nameFromBinding = getTypeBinding().getSuperclass().getName();
//        }

//        FamixClass lSuperClass = null;
//        if ((superType == null) && nameFromBinding.equals("Object")) {
//            lSuperClass = getClass(getTypeBinding().getSuperclass(), null, false);
//        } else {
//            lSuperClass = getClass(superType.resolveBinding(), superType, false);
//        }
        if (superType != null) {
            FamixClass lSuperClass = getClass(superType.resolveBinding(), superType, false);
          lSuperClass = (FamixClass) getModel().addElement(lSuperClass);
          FamixAssociation inheritance = getFactory().createInheritance(getCurrType(), lSuperClass);
        
          inheritance.setSourceAnchor(getSourceAnchor(superType));
        
View Full Code Here


  }

  @Override
  public boolean visit(FieldDeclaration node) {
    AbstractTypeHandle currentTypeHandle = currentType();
    Type fieldType = node.getType();
   
    List<?> fragments = node.fragments();
    for(Object o : fragments) {
      if(o instanceof VariableDeclarationFragment) {
        VariableDeclarationFragment fragment = (VariableDeclarationFragment) o;
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

  }

  private void addInterfaces(AbstractTypeHandle typeHandle, List<?> interfaces) {
    for(Object o : interfaces) {
      if(o instanceof Type) {
        Type ift = (Type) o;
        InterfaceHandle interfaceHandle = model.getInterfaceHandleFor(VisitorUtil.resolveAndEncode(ift), VisitorUtil.identifierFor(ift));
        typeHandle.addInterface(interfaceHandle);
      }
    }
  }
View Full Code Here

      }
    }
  }

  private void addReturnType(MethodDeclaration node, MethodHandle methodHandle) {
    Type returnType = node.getReturnType2();
    AbstractTypeHandle returnTypeHandle = model.getTypeHandleFor(VisitorUtil.resolveAndEncode(returnType), VisitorUtil.identifierFor(returnType), VisitorUtil.isInterface(returnType));
    methodHandle.setReturnType(returnTypeHandle);
  }
View Full Code Here

      for (Iterator<BodyDeclaration> I = bodyDeclarations.iterator(); I.hasNext();) {
        BodyDeclaration bodyDeclaration = I.next();
        if (bodyDeclaration instanceof MethodDeclaration) {
          MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
          // make return type void
          Type returnType;
          {
            returnType = methodDeclaration.getReturnType2();
            methodDeclaration.setReturnType2(ast.newPrimitiveType(PrimitiveType.VOID));
          }
          // process JavaDoc
          {
            Javadoc javadoc = methodDeclaration.getJavadoc();
            if (javadoc != null) {
              List<TagElement> tags = DomGenerics.tags(javadoc);
              for (Iterator<TagElement> tagIter = tags.iterator(); tagIter.hasNext();) {
                TagElement tag = tagIter.next();
                if ("@gwt.typeArgs".equals(tag.getTagName())) {
                  tagIter.remove();
                } else if ("@return".equals(tag.getTagName())) {
                  if (!tag.fragments().isEmpty()) {
                    tag.setTagName("@param callback the callback to return");
                  } else {
                    tagIter.remove();
                  }
                } else if ("@wbp.gwt.Request".equals(tag.getTagName())) {
                  tagIter.remove();
                  addImport(serviceRoot, "com.google.gwt.http.client.Request");
                  methodDeclaration.setReturnType2(ast.newSimpleType(ast.newName("Request")));
                }
              }
              // remove empty JavaDoc
              if (tags.isEmpty()) {
                methodDeclaration.setJavadoc(null);
              }
            }
          }
          // add AsyncCallback parameter
          {
            addImport(serviceRoot, "com.google.gwt.user.client.rpc.AsyncCallback");
            // prepare "callback" type
            Type callbackType;
            {
              callbackType = ast.newSimpleType(ast.newName("AsyncCallback"));
              Type objectReturnType = getObjectType(returnType);
              ParameterizedType parameterizedType = ast.newParameterizedType(callbackType);
              DomGenerics.typeArguments(parameterizedType).add(objectReturnType);
              callbackType = parameterizedType;
            }
            // prepare "callback" parameter
View Full Code Here

      CompilationUnit serviceUnit,
      TypeDeclaration serviceType) throws Exception {
    String serviceName = AstNodeUtils.getFullyQualifiedName(serviceType, false);
    AST ast = serviceType.getAST();
    for (Iterator<?> I = serviceType.superInterfaceTypes().iterator(); I.hasNext();) {
      Type type = (Type) I.next();
      ITypeBinding typeBinding = AstNodeUtils.getTypeBinding(type);
      if (AstNodeUtils.isSuccessorOf(typeBinding, Constants.CLASS_REMOTE_SERVICE)) {
        String superServiceName = AstNodeUtils.getFullyQualifiedName(typeBinding, false);
        String superAsyncName = superServiceName + "Async";
        if (javaProject.findType(superAsyncName) != null) {
View Full Code Here

   @Override
   public O addInterface(final String type)
   {
      if (!this.hasInterface(type))
      {
         Type interfaceType = JDTHelper.getInterfaces(
                  Roaster.parse(JavaInterfaceImpl.class,
                           "public interface Mock extends " + Types.toSimpleName(type)
                                    + " {}").getBodyDeclaration()).get(0);

         if (this.hasInterface(Types.toSimpleName(type)) || this.hasImport(Types.toSimpleName(type)))
View Full Code Here

         if (!this.hasImport(Types.toSimpleName(type)))
         {
            this.addImport(type);
         }

         Type t = interfaces.get(0);
         ASTNode node = ASTNode.copySubtree(unit.getAST(), t);
         JDTHelper.getInterfaces(getBodyDeclaration()).add((Type) node);
      }
      else
      {
View Full Code Here

         origin.addImport(typeName);
      }

      Code primitive = PrimitiveType.toCode(typeName);

      Type type = null;
      if (primitive != null)
      {
         type = ast.newPrimitiveType(primitive);
      }
      else
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.