PsiMethod (FieldAccessType accessType, PsiClass outerClass, PsiElementFactory elementFactory) { PsiClass containingClass = myField.getContainingClass(); String className = containingClass == null ? null : ClassUtil.getJVMClassName(containingClass); String fieldName = myField.getName(); if (className == null) { LOG.warn("Code is incomplete. Class name or field name not found"); return null; } String methodName = PsiReflectionAccessUtil.getUniqueMethodName(outerClass, "accessToField" + StringUtil.capitalize(fieldName)); ReflectionAccessMethodBuilder methodBuilder = new ReflectionAccessMethodBuilder(methodName); if (FieldAccessType.GET.equals(accessType)) { methodBuilder.accessedField(className, fieldName).setReturnType(myAccessibleType); } else { methodBuilder.updatedField(className, fieldName) .setReturnType("void"); } methodBuilder.setStatic(outerClass.hasModifierProperty(PsiModifier.STATIC)) .addParameter("java.lang.Object", "object") .addParameter("java.lang.Object", "value"); return methodBuilder.build(elementFactory, outerClass); }