void (@NotNull Map<PsiField, PsiMethod> fieldMethodMap, @NotNull PsiClass psiClass, String annotationClassName) { if (fieldMethodMap.isEmpty()) { return; } final PsiMethod firstPropertyMethod = fieldMethodMap.values().iterator().next(); final boolean useAnnotationOnClass = haveAllMethodsSameAccessLevel(fieldMethodMap.values()) && isNotAnnotatedWithOrSameAccessLevelAs(psiClass, firstPropertyMethod, annotationClassName); if (useAnnotationOnClass) { addAnnotation(psiClass, firstPropertyMethod, annotationClassName); } for (Map.Entry<PsiField, PsiMethod> fieldMethodEntry : fieldMethodMap.entrySet()) { final PsiField propertyField = fieldMethodEntry.getKey(); final PsiMethod propertyMethod = fieldMethodEntry.getValue(); if (null != propertyField) { boolean isStatic = propertyField.hasModifierProperty(PsiModifier.STATIC); if (isStatic || !useAnnotationOnClass) { addAnnotation(propertyField, propertyMethod, annotationClassName); } // Move all annotations to field declaration for (PsiAnnotation psiMethodAnnotation : propertyMethod.getModifierList().getAnnotations()) { psiClass.addBefore(psiMethodAnnotation, propertyField); } propertyMethod.delete(); } } }