org.eclipse.jdt.core.dom.Annotation.resolveTypeBinding()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.eclipse.jdt.core.dom.Annotation.resolveTypeBinding()方法的一些代码示例,展示了Annotation.resolveTypeBinding()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.resolveTypeBinding()方法的具体详情如下:
包路径:org.eclipse.jdt.core.dom.Annotation
类名称:Annotation
方法名:resolveTypeBinding

Annotation.resolveTypeBinding介绍

暂无

代码示例

代码示例来源:origin: org.projectlombok/lombok

if (modifier instanceof org.eclipse.jdt.core.dom.Annotation) {
  org.eclipse.jdt.core.dom.Annotation annotation = (org.eclipse.jdt.core.dom.Annotation)modifier;
  String qualifiedAnnotationName = annotation.resolveTypeBinding().getQualifiedName();
  if (!"java.lang.Override".equals(qualifiedAnnotationName) && !"java.lang.SuppressWarnings".equals(qualifiedAnnotationName)) annotations.add(annotation);

代码示例来源:origin: org.projectlombok/lombok

signature.append("@").append(annotation.resolveTypeBinding().getQualifiedName());
if (!values.isEmpty()) {
  signature.append("(");

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

private static IMethodBinding findAnnotationMember(Annotation annotation, String name) {
  ITypeBinding annotBinding= annotation.resolveTypeBinding();
  if (annotBinding != null) {
    return Bindings.findMethodInType(annotBinding, name, (String[]) null);
  }
  return null;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation

public static IMethodBinding findAnnotationMember(Annotation annotation, String name) {
  ITypeBinding annotBinding= annotation.resolveTypeBinding();
  if (annotBinding != null) {
    return Bindings.findMethodInType(annotBinding, name, (String[]) null);
  }
  return null;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private static IMethodBinding findAnnotationMember(Annotation annotation, String name) {
  ITypeBinding annotBinding= annotation.resolveTypeBinding();
  if (annotBinding != null) {
    return Bindings.findMethodInType(annotBinding, name, (String[]) null);
  }
  return null;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

public MissingAnnotationAttributesProposal(ICompilationUnit cu, Annotation annotation, int relevance) {
  super(CorrectionMessages.MissingAnnotationAttributesProposal_add_missing_attributes_label, cu, null, relevance, null);
  setImage(JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE));
  fAnnotation= annotation;
  Assert.isNotNull(fAnnotation.resolveTypeBinding());
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public MissingAnnotationAttributesProposal(ICompilationUnit cu, Annotation annotation, int relevance) {
  super(CorrectionMessages.MissingAnnotationAttributesProposal_add_missing_attributes_label, cu, null, relevance, null);
  setImage(JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE));
  fAnnotation= annotation;
  Assert.isNotNull(fAnnotation.resolveTypeBinding());
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

public MissingAnnotationAttributesProposal(ICompilationUnit cu, Annotation annotation, int relevance) {
  super(CorrectionMessages.MissingAnnotationAttributesProposal_add_missing_attributes_label, cu, null, relevance, null);
  setImage(JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE));
  fAnnotation= annotation;
  Assert.isNotNull(fAnnotation.resolveTypeBinding());
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private static Annotation findExistingAnnotation(List<? extends ASTNode> modifiers) {
    for (int i= 0, len= modifiers.size(); i < len; i++) {
      Object curr= modifiers.get(i);
      if (curr instanceof NormalAnnotation || curr instanceof SingleMemberAnnotation) {
        Annotation annotation= (Annotation) curr;
        ITypeBinding typeBinding= annotation.resolveTypeBinding();
        if (typeBinding != null) {
          if ("java.lang.SuppressWarnings".equals(typeBinding.getQualifiedName())) { //$NON-NLS-1$
            return annotation;
          }
        } else {
          String fullyQualifiedName= annotation.getTypeName().getFullyQualifiedName();
          if ("SuppressWarnings".equals(fullyQualifiedName) || "java.lang.SuppressWarnings".equals(fullyQualifiedName)) { //$NON-NLS-1$ //$NON-NLS-2$
            return annotation;
          }
        }
      }
    }
    return null;
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private static Annotation findExistingAnnotation(List<? extends ASTNode> modifiers) {
    for (int i= 0, len= modifiers.size(); i < len; i++) {
      Object curr= modifiers.get(i);
      if (curr instanceof NormalAnnotation || curr instanceof SingleMemberAnnotation) {
        Annotation annotation= (Annotation) curr;
        ITypeBinding typeBinding= annotation.resolveTypeBinding();
        if (typeBinding != null) {
          if ("java.lang.SuppressWarnings".equals(typeBinding.getQualifiedName())) { //$NON-NLS-1$
            return annotation;
          }
        } else {
          String fullyQualifiedName= annotation.getTypeName().getFullyQualifiedName();
          if ("SuppressWarnings".equals(fullyQualifiedName) || "java.lang.SuppressWarnings".equals(fullyQualifiedName)) { //$NON-NLS-1$ //$NON-NLS-2$
            return annotation;
          }
        }
      }
    }
    return null;
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

private static Annotation findExistingAnnotation(List modifiers) {
    for (int i= 0, len= modifiers.size(); i < len; i++) {
      Object curr= modifiers.get(i);
      if (curr instanceof NormalAnnotation || curr instanceof SingleMemberAnnotation) {
        Annotation annotation= (Annotation) curr;
        ITypeBinding typeBinding= annotation.resolveTypeBinding();
        if (typeBinding != null) {
          if ("java.lang.SuppressWarnings".equals(typeBinding.getQualifiedName())) { //$NON-NLS-1$
            return annotation;
          }
        } else {
          String fullyQualifiedName= annotation.getTypeName().getFullyQualifiedName();
          if ("SuppressWarnings".equals(fullyQualifiedName) || "java.lang.SuppressWarnings".equals(fullyQualifiedName)) { //$NON-NLS-1$ //$NON-NLS-2$
            return annotation;
          }
        }
      }
    }
    return null;
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

public static void addValueForAnnotationProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
  ICompilationUnit cu= context.getCompilationUnit();
  ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot());
  if (selectedNode instanceof Annotation) {
    Annotation annotation= (Annotation) selectedNode;
    if (annotation.resolveTypeBinding() == null) {
      return;
    }
    MissingAnnotationAttributesProposal proposal= new MissingAnnotationAttributesProposal(cu, annotation, 10);
    proposals.add(proposal);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public static void addValueForAnnotationProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) {
  ICompilationUnit cu= context.getCompilationUnit();
  ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot());
  if (selectedNode instanceof Annotation) {
    Annotation annotation= (Annotation) selectedNode;
    if (annotation.resolveTypeBinding() == null) {
      return;
    }
    MissingAnnotationAttributesProposal proposal= new MissingAnnotationAttributesProposal(cu, annotation, 10);
    proposals.add(proposal);        
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

public static void addValueForAnnotationProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
  ICompilationUnit cu= context.getCompilationUnit();
  ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot());
  if (selectedNode instanceof Annotation) {
    Annotation annotation= (Annotation) selectedNode;
    if (annotation.resolveTypeBinding() == null) {
      return;
    }
    MissingAnnotationAttributesProposal proposal= new MissingAnnotationAttributesProposal(cu, annotation, 10);
    proposals.add(proposal);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jpt.core

private String qualifiedName(Annotation annotation) {
    ITypeBinding typeBinding = annotation.resolveTypeBinding();
    if (typeBinding != null) {
      String resolvedName = typeBinding.getQualifiedName();
      if (resolvedName != null) {
        return resolvedName;
      }
    }
    // hack(?): check for a matching import because when moving a stand-alone
    // annotation to its container in CombinationIndexedDeclarationAnnotationAdapter
    // the container's import is added but then it won't "resolve" upon
    // subsequent lookups... :-(
    return this.importFor(annotation.getTypeName().getFullyQualifiedName());  // look for a matching import

    // OLD METHOD SOURCE:
//        String name = annotation.getTypeName().getFullyQualifiedName();
//        if (name.indexOf('.') != -1) {
//            return name;  // name is already qualified
//        }
//        String resolvedName = JDTTools.resolve(name, this.type());
//        // hack(?): check for a matching import because when moving a stand-alone
//        // annotation to its container in CombinationIndexedDeclarationAnnotationAdapter
//        // the container's import is added but then it won't "resolve" upon
//        // subsequent lookups... :-(
//        return this.importFor(name);  // look for a matching import
  }

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

protected ASTRewrite getRewrite() throws CoreException {
  AST ast= fAnnotation.getAST();
  ASTRewrite rewrite= ASTRewrite.create(ast);
  createImportRewrite((CompilationUnit) fAnnotation.getRoot());
  
  ListRewrite listRewrite;
  if (fAnnotation instanceof NormalAnnotation) {
    listRewrite= rewrite.getListRewrite(fAnnotation, NormalAnnotation.VALUES_PROPERTY);
  } else {
    NormalAnnotation newAnnotation= ast.newNormalAnnotation();
    newAnnotation.setTypeName((Name) rewrite.createMoveTarget(fAnnotation.getTypeName()));
    rewrite.replace(fAnnotation, newAnnotation, null);
    
    listRewrite= rewrite.getListRewrite(newAnnotation, NormalAnnotation.VALUES_PROPERTY);
  }
  addMissingAtributes(fAnnotation.resolveTypeBinding(), listRewrite);
      
  return rewrite;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected ASTRewrite getRewrite() throws CoreException {
  AST ast= fAnnotation.getAST();
  ASTRewrite rewrite= ASTRewrite.create(ast);
  createImportRewrite((CompilationUnit) fAnnotation.getRoot());
  ListRewrite listRewrite;
  if (fAnnotation instanceof NormalAnnotation) {
    listRewrite= rewrite.getListRewrite(fAnnotation, NormalAnnotation.VALUES_PROPERTY);
  } else {
    NormalAnnotation newAnnotation= ast.newNormalAnnotation();
    newAnnotation.setTypeName((Name) rewrite.createMoveTarget(fAnnotation.getTypeName()));
    rewrite.replace(fAnnotation, newAnnotation, null);
    listRewrite= rewrite.getListRewrite(newAnnotation, NormalAnnotation.VALUES_PROPERTY);
  }
  addMissingAtributes(fAnnotation.resolveTypeBinding(), listRewrite);
  return rewrite;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
protected ASTRewrite getRewrite() throws CoreException {
  AST ast= fAnnotation.getAST();
  ASTRewrite rewrite= ASTRewrite.create(ast);
  createImportRewrite((CompilationUnit) fAnnotation.getRoot());
  ListRewrite listRewrite;
  if (fAnnotation instanceof NormalAnnotation) {
    listRewrite= rewrite.getListRewrite(fAnnotation, NormalAnnotation.VALUES_PROPERTY);
  } else {
    NormalAnnotation newAnnotation= ast.newNormalAnnotation();
    newAnnotation.setTypeName((Name) rewrite.createMoveTarget(fAnnotation.getTypeName()));
    rewrite.replace(fAnnotation, newAnnotation, null);
    listRewrite= rewrite.getListRewrite(newAnnotation, NormalAnnotation.VALUES_PROPERTY);
  }
  addMissingAtributes(fAnnotation.resolveTypeBinding(), listRewrite);
  return rewrite;
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

ITypeBinding annotBinding= annotation.resolveTypeBinding();
if (annotBinding == null) {
  return;

代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui

ITypeBinding annotBinding= annotation.resolveTypeBinding();
if (annotBinding == null) {
  return;

相关文章