本文整理汇总了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);
}
}
示例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());
}
}
}
示例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;
}
示例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指定了唯一标识");
}
示例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 );
}
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}