private boolean verifyLombokAnnotationPresent(@NotNull PsiClass psiClass) { if (PsiAnnotationUtil.checkAnnotationsSimpleNameExistsIn(psiClass, registeredAnnotationNames)) { return true; } Collection<PsiField> psiFields = PsiClassUtil.collectClassFieldsIntern(psiClass); for (PsiField psiField : psiFields) { if (PsiAnnotationUtil.checkAnnotationsSimpleNameExistsIn( psiField, registeredAnnotationNames)) { return true; } } Collection<PsiMethod> psiMethods = PsiClassUtil.collectClassMethodsIntern(psiClass); for (PsiMethod psiMethod : psiMethods) { if (PsiAnnotationUtil.checkAnnotationsSimpleNameExistsIn( psiMethod, registeredAnnotationNames)) { return true; } } final PsiElement psiClassParent = psiClass.getParent(); if (psiClassParent instanceof PsiClass) { return verifyLombokAnnotationPresent((PsiClass) psiClassParent); } return false; }
public static boolean validateSingularName( PsiAnnotation singularAnnotation, String psiFieldName) { String singularName = PsiAnnotationUtil.getStringAnnotationValue(singularAnnotation, "value"); if (StringUtil.isEmptyOrSpaces(singularName)) { singularName = Singulars.autoSingularize(psiFieldName); return singularName != null; } return true; }
protected String createSingularName(PsiAnnotation singularAnnotation, String psiFieldName) { String singularName = PsiAnnotationUtil.getStringAnnotationValue(singularAnnotation, "value"); if (StringUtil.isEmptyOrSpaces(singularName)) { singularName = Singulars.autoSingularize(psiFieldName); if (singularName == null) { singularName = psiFieldName; } } return singularName; }
@NotNull public Collection<PsiAnnotation> collectProcessedAnnotations(@NotNull PsiClass psiClass) { List<PsiAnnotation> result = new ArrayList<PsiAnnotation>(); for (PsiMethod psiMethod : PsiClassUtil.collectClassMethodsIntern(psiClass)) { PsiAnnotation psiAnnotation = PsiAnnotationUtil.findAnnotation(psiMethod, getSupportedAnnotation()); if (null != psiAnnotation) { result.add(psiAnnotation); } } return result; }
@NotNull @Override public List<? super PsiElement> process(@NotNull PsiClass psiClass) { List<? super PsiElement> result = new ArrayList<PsiElement>(); for (PsiMethod psiMethod : PsiClassUtil.collectClassMethodsIntern(psiClass)) { PsiAnnotation psiAnnotation = PsiAnnotationUtil.findAnnotation(psiMethod, getSupportedAnnotation()); if (null != psiAnnotation) { if (validate(psiAnnotation, psiMethod, ProblemEmptyBuilder.getInstance())) { processIntern(psiMethod, psiAnnotation, result); } } } return result; }
public static boolean isLazyGetterHandled(HighlightInfo highlightInfo, PsiFile file) { PsiElement element = file.findElementAt(highlightInfo.getStartOffset()); if (!(element instanceof PsiIdentifier)) { return false; } PsiField field = PsiTreeUtil.getParentOfType(element, PsiField.class); if (field == null) { return false; } final PsiAnnotation getterAnnotation = PsiAnnotationSearchUtil.findAnnotation(field, Getter.class); return null != getterAnnotation && PsiAnnotationUtil.getBooleanAnnotationValue(getterAnnotation, "lazy", false); }