ChainExpressionModel (@NotNull PsiAssignmentExpression assignment, @NotNull PsiExpression chainExpression) { if (PsiUtil.skipParenthesizedExprDown(assignment.getRExpression()) != chainExpression) return null; PsiReferenceExpression ref = tryCast(assignment.getLExpression(), PsiReferenceExpression.class); if (ref == null) return null; PsiVariable variable = tryCast(ref.resolve(), PsiVariable.class); if (variable == null || variable.hasModifierProperty(PsiModifier.FINAL)) return null; String name = variable.getName(); return name == null ? null : new ChainAssignment(name); }