当前位置: 首页>>代码示例>>Java>>正文


Java PsiAnnotation.getQualifiedName方法代码示例

本文整理汇总了Java中com.intellij.psi.PsiAnnotation.getQualifiedName方法的典型用法代码示例。如果您正苦于以下问题:Java PsiAnnotation.getQualifiedName方法的具体用法?Java PsiAnnotation.getQualifiedName怎么用?Java PsiAnnotation.getQualifiedName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.PsiAnnotation的用法示例。


在下文中一共展示了PsiAnnotation.getQualifiedName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAttributeFromAnnotation

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
private String getAttributeFromAnnotation(
    PsiAnnotation annotation, String annotationType, final String attribute)
    throws InvalidAnnotationException, MissingAttributeException {

  String annotationQualifiedName = annotation.getQualifiedName();
  if (annotationQualifiedName == null) {
    throw new InvalidAnnotationException(annotation, annotationType);
  }

  if (annotationQualifiedName.equals(annotationType)) {
    PsiAnnotationMemberValue annotationMemberValue = annotation.findAttributeValue(attribute);
    if (annotationMemberValue == null) {
      throw new MissingAttributeException(annotation, attribute);
    }

    String httpMethodWithQuotes = annotationMemberValue.getText();
    return httpMethodWithQuotes.substring(1, httpMethodWithQuotes.length() - 1);
  } else {
    throw new InvalidAnnotationException(annotation, annotationType);
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:22,代码来源:RestSignatureInspection.java

示例2: visitAnnotation

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Override
public void visitAnnotation(PsiAnnotation annotation) {
  super.visitAnnotation(annotation);

  final String qualifiedName = annotation.getQualifiedName();
  if (StringUtils.isNotBlank(qualifiedName) && allProblemHandlers.containsKey(qualifiedName)) {
    final Collection<SqliteMagicProblem> problems = new HashSet<SqliteMagicProblem>();

    for (Processor inspector : allProblemHandlers.get(qualifiedName)) {
      problems.addAll(inspector.verifyAnnotation(annotation));
    }

    for (SqliteMagicProblem problem : problems) {
      holder.registerProblem(annotation, problem.getMessage(), problem.getHighlightType(), problem.getQuickFixes());
    }
  }
}
 
开发者ID:SiimKinks,项目名称:sqlitemagic,代码行数:18,代码来源:SqliteMagicInspection.java

示例3: getQualifierAnnotations

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
public static Set<String> getQualifierAnnotations(PsiElement element) {
  Set<String> qualifiedClasses = new HashSet<String>();

  if (element instanceof PsiModifierListOwner) {
    PsiModifierListOwner listOwner = (PsiModifierListOwner) element;
    PsiModifierList modifierList = listOwner.getModifierList();

    if (modifierList != null) {
      for (PsiAnnotation psiAnnotation : modifierList.getAnnotations()) {
        if (psiAnnotation != null && psiAnnotation.getQualifiedName() != null) {
          JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(element.getProject());
          PsiClass psiClass = psiFacade.findClass(psiAnnotation.getQualifiedName(),
              GlobalSearchScope.projectScope(element.getProject()));

          if (hasAnnotation(psiClass, CLASS_QUALIFIER)) {
            qualifiedClasses.add(psiAnnotation.getQualifiedName());
          }
        }
      }
    }
  }

  return qualifiedClasses;
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:25,代码来源:PsiConsultantImpl.java

示例4: visitNewExpression

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Override
public void visitNewExpression(PsiNewExpression expression) {
    super.visitNewExpression(expression);

    PsiMethod constructor = expression.resolveConstructor();
    if (constructor == null) return;

    JavaEvaluator evaluator = mContext.getEvaluator();
    PsiClass cls = constructor.getContainingClass();
    boolean isView = evaluator.extendsClass(cls, CLASS_VIEW, true);
    if (!isView) return;

    Location location = this.mContext.getLocation(expression);

    PsiElement psiElement = expression.getParent();

    //创建的变量没有赋值给本地变量,无法指定注解
    if (!(psiElement instanceof PsiLocalVariable)) {
        this.mContext.report(DynamicNewViewDetector.ISSUE, expression, location, "检测到动态创建view操作,new 操作的结果需要赋值给本地变量");
        return;
    }

    PsiLocalVariable localVariable = (PsiLocalVariable) psiElement;
    PsiModifierList modifierList = localVariable.getModifierList();
    if (modifierList == null) {
        this.mContext.report(DynamicNewViewDetector.ISSUE, expression, location, "检测到动态创建view操作,确认是否为view指定了唯一标识");
        return;
    }

    PsiAnnotation[] annotations = modifierList.getAnnotations();
    for (PsiAnnotation annotation : annotations) {
        String fullName = annotation.getQualifiedName();
        if (IDENTIFIER_ANNOTATION.equals(fullName)) {
            return;
        }
    }

    this.mContext.report(DynamicNewViewDetector.ISSUE, expression, location, "检测到动态创建view操作,确认是否为view指定了唯一标识");
}
 
开发者ID:jessie345,项目名称:CustomLintRules,代码行数:40,代码来源:DynamicNewViewDetector.java

示例5: addAnnotations

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
private void addAnnotations( SrcAnnotated<?> srcAnnotated, PsiModifierListOwner annotated )
{
  for( PsiAnnotation psiAnno : annotated.getModifierList().getAnnotations() )
  {
    SrcAnnotationExpression annoExpr = new SrcAnnotationExpression( psiAnno.getQualifiedName() );
    for( PsiNameValuePair value : psiAnno.getParameterList().getAttributes() )
    {
      SrcArgument srcArg = new SrcArgument( new SrcRawExpression( value.getLiteralValue() ) );
      annoExpr.addArgument( srcArg ).name( value.getName() );
    }
    srcAnnotated.addAnnotation( annoExpr );
  }
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:14,代码来源:StubBuilder.java

示例6: isConsumerEndpoint

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Override
public boolean isConsumerEndpoint(PsiElement element) {
    if (getIdeaUtils().isFromJavaMethodCall(element, true, CONSUMER_ENDPOINT)) {
        return true;
    }
    // annotation
    PsiAnnotation annotation = PsiTreeUtil.getParentOfType(element, PsiAnnotation.class);
    if (annotation != null && annotation.getQualifiedName() != null) {
        return annotation.getQualifiedName().equals("org.apache.camel.Consume");
    }
    return false;
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:13,代码来源:JavaCamelIdeaUtils.java

示例7: isProducerEndpoint

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Override
public boolean isProducerEndpoint(PsiElement element) {
    if (getIdeaUtils().isFromJavaMethodCall(element, true, PRODUCER_ENDPOINT)) {
        return true;
    }
    // annotation
    PsiAnnotation annotation = PsiTreeUtil.getParentOfType(element, PsiAnnotation.class);
    if (annotation != null && annotation.getQualifiedName() != null) {
        return annotation.getQualifiedName().equals("org.apache.camel.Produce");
    }
    return false;
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:13,代码来源:JavaCamelIdeaUtils.java

示例8: createAddToSpecialAnnotationFixes

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
public static void createAddToSpecialAnnotationFixes(@NotNull PsiModifierListOwner owner, @NotNull Processor<String> processor) {
  final PsiModifierList modifierList = owner.getModifierList();
  if (modifierList != null) {
    final PsiAnnotation[] psiAnnotations = modifierList.getAnnotations();
    for (PsiAnnotation psiAnnotation : psiAnnotations) {
      @NonNls final String name = psiAnnotation.getQualifiedName();
      if (name == null) continue;
      if (name.startsWith("java.") || name.startsWith("javax.") ||
          name.startsWith("org.jetbrains.") && AnnotationUtil.isJetbrainsAnnotation(StringUtil.getShortName(name))) continue;
      if (!processor.process(name)) break;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:SpecialAnnotationsUtilBase.java

示例9: getTestSize

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Nullable
private static TestSize getTestSize(PsiAnnotation[] annotations) {
  for (PsiAnnotation annotation : annotations) {
    String qualifiedName = annotation.getQualifiedName();
    TestSize testSize = ANNOTATION_TO_TEST_SIZE.get(qualifiedName);
    if (testSize != null) {
      return testSize;
    }
  }
  return null;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:12,代码来源:TestSizeAnnotationMap.java

示例10: getAndCacheFQN

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Nullable
private static String getAndCacheFQN(@NotNull PsiAnnotation annotation, @Nullable String referenceName) {
  String annotationQualifiedName = annotation.getCopyableUserData(LOMBOK_ANNOTATION_FQN_KEY);
  // if not cached or cache is not up to date (because existing annotation was renamed for example)
  if (null == annotationQualifiedName || (null != referenceName && !annotationQualifiedName.endsWith(".".concat(referenceName)))) {
    annotationQualifiedName = annotation.getQualifiedName();
    if (null != annotationQualifiedName && annotationQualifiedName.indexOf('.') > -1) {
      annotation.putCopyableUserData(LOMBOK_ANNOTATION_FQN_KEY, annotationQualifiedName);
    }
  }
  return annotationQualifiedName;
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:13,代码来源:PsiAnnotationSearchUtil.java

示例11: visitAnnotation

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Override
public void visitAnnotation(PsiAnnotation annotation) {
  final String qualifiedName = annotation.getQualifiedName();
  if (qualifiedName != null) {
    if (qualifiedName.equals(Types.AUTO_BOUND)) {
      checkModelCanBeDirectlyInjected(holder, annotation);
    }
  }
}
 
开发者ID:errai,项目名称:errai-intellij-idea-plugin,代码行数:10,代码来源:DataBinderCanBeModelInspection.java

示例12: visitAnnotation

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Override
public void visitAnnotation(PsiAnnotation annotation) {
  final String qualifiedName = annotation.getQualifiedName();
  if (qualifiedName != null) {
    if (qualifiedName.equals(Types.MODEL_SETTER)) {
      ensureModelSetterIsValid(holder, annotation);
    }
  }
}
 
开发者ID:errai,项目名称:errai-intellij-idea-plugin,代码行数:10,代码来源:ModelSetterValidityInspection.java

示例13: visitAnnotation

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Override
public void visitAnnotation(PsiAnnotation annotation) {
  final String qualifiedName = annotation.getQualifiedName();
  if (qualifiedName != null) {
    if (qualifiedName.equals(Types.MODEL_SETTER)) {
      ensureBeanisProxyable(holder, annotation);
    }
  }
}
 
开发者ID:errai,项目名称:errai-intellij-idea-plugin,代码行数:10,代码来源:ModelSetterProxyableInspection.java

示例14: visitAnnotation

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Override
public void visitAnnotation(PsiAnnotation annotation) {
  final String qualifiedName = annotation.getQualifiedName();
  if (qualifiedName != null) {
    if (qualifiedName.equals(Types.BOUND)) {
      ensureBoundFieldIsValid(holder, annotation);
    }
  }
}
 
开发者ID:errai,项目名称:errai-intellij-idea-plugin,代码行数:10,代码来源:BoundFieldValidityInspection.java

示例15: visitAnnotation

import com.intellij.psi.PsiAnnotation; //导入方法依赖的package包/类
@Override
public void visitAnnotation(PsiAnnotation annotation) {
  final String qualifiedName = annotation.getQualifiedName();
  if (qualifiedName != null) {
    if (qualifiedName.equals(Types.AUTO_BOUND) || qualifiedName.equals(Types.MODEL)) {
      ensureBoundModelIsValid(holder, annotation);
    }
  }
}
 
开发者ID:errai,项目名称:errai-intellij-idea-plugin,代码行数:10,代码来源:BoundModelValidInspection.java


注:本文中的com.intellij.psi.PsiAnnotation.getQualifiedName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。