Java Code Examples for com.intellij.psi.PsiClass#isAnnotationType()
The following examples show how to use
com.intellij.psi.PsiClass#isAnnotationType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractFieldNameConstantsProcessor.java From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License | 5 votes |
private boolean validateAnnotationOnRightType(@NotNull PsiClass psiClass, @NotNull ProblemBuilder builder) { if (psiClass.isAnnotationType() || psiClass.isInterface()) { builder.addError("'@FieldNameConstants' is only supported on a class or enum"); return false; } return true; }
Example 2
Source File: LombokAugmentProvider.java From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License | 5 votes |
@NotNull @Override public <Psi extends PsiElement> List<Psi> getAugments(@NotNull PsiElement element, @NotNull final Class<Psi> type) { final List<Psi> emptyResult = Collections.emptyList(); if ((type != PsiClass.class && type != PsiField.class && type != PsiMethod.class) || !(element instanceof PsiExtensibleClass)) { return emptyResult; } // Don't filter !isPhysical elements or code auto completion will not work if (!element.isValid()) { return emptyResult; } final PsiClass psiClass = (PsiClass) element; // Skip processing of Annotations and Interfaces if (psiClass.isAnnotationType() || psiClass.isInterface()) { return emptyResult; } // skip processing if plugin is disabled final Project project = element.getProject(); if (!ProjectSettings.isLombokEnabledInProject(project)) { return emptyResult; } final List<Psi> cachedValue; if (type == PsiField.class) { cachedValue = CachedValuesManager.getCachedValue(element, new FieldLombokCachedValueProvider<>(type, psiClass)); } else if (type == PsiMethod.class) { cachedValue = CachedValuesManager.getCachedValue(element, new MethodLombokCachedValueProvider<>(type, psiClass)); } else { cachedValue = CachedValuesManager.getCachedValue(element, new ClassLombokCachedValueProvider<>(type, psiClass)); } return null != cachedValue ? cachedValue : emptyResult; }
Example 3
Source File: UtilityClassProcessor.java From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License | 4 votes |
private static boolean checkWrongType(PsiClass psiClass) { return psiClass != null && (psiClass.isInterface() || psiClass.isEnum() || psiClass.isAnnotationType()); }