GrExpression (GrMethodCall call, String accessorName) { String name = GroovyPropertyUtils.getPropertyNameByGetterName(accessorName, true); GrReferenceExpression refExpr = (GrReferenceExpression)call.getInvokedExpression(); String oldNameStr = refExpr.getReferenceNameElement().getText(); String newRefExpr = StringUtil.trimEnd(refExpr.getText(), oldNameStr) + name; final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(call.getProject()); return factory.createExpressionFromText(newRefExpr, call); }