void (String varName, PsiType type, PsiClass resolved, PsiSubstitutor substitutor, String fieldName, GrExpression expression) { StringBuilder builder = new StringBuilder(); final PsiMethod setter = GroovyPropertyUtils.findPropertySetter(resolved, fieldName, false, true); if (setter != null) { final GrVariableDeclaration var = factory.createVariableDeclaration(ArrayUtilRt.EMPTY_STRING_ARRAY, "", type, varName); final GrReferenceExpression caller = factory.createReferenceExpressionFromText(varName, var); invokeMethodOn(setter, caller, new GrExpression[]{expression}, GrNamedArgument.EMPTY_ARRAY, GrClosableBlock.EMPTY_ARRAY, substitutor, expression); } else { builder.append(varName).append('.').append(fieldName).append(" = "); expression.accept(new ExpressionGenerator(builder, context)); } context.myStatements.add(builder.toString()); }