PsiMember (@NotNull PsiClass aClass, @NotNull PropertyMemberType memberType) { if (memberType == PropertyMemberType.FIELD) { return aClass.findFieldByName(getFieldName(aClass), false); } else if (memberType == PropertyMemberType.GETTER) { try { PsiElementFactory psiElementFactory = JavaPsiFacade.getElementFactory(aClass.getProject()); PsiField field = psiElementFactory.createField(myAttributeName, myType); PsiMethod[] templates = GetterSetterPrototypeProvider.generateGetterSetters(field, myMemberType == PropertyMemberType.GETTER); for (PsiMethod template : templates) { PsiMethod existingMethod = aClass.findMethodBySignature(template, true); if (existingMethod != null) return existingMethod; } } catch (IncorrectOperationException e) { assert false : e; } } return null; }