private static ConditionalExpression createPattern() { final Expression target = new TypeReferenceExpression(new AnyNode().toType()).makeOptional().toExpression(); final MemberReferenceExpression access = new MemberReferenceExpression(target, Pattern.ANY_STRING); @SuppressWarnings("UnnecessaryLocalVariable") final ConditionalExpression pattern = new ConditionalExpression( new BinaryOperatorExpression( access.withName("fieldAccess").toExpression(), BinaryOperatorType.EQUALITY, new NullReferenceExpression() ), new AssignmentExpression( new BackReference("fieldAccess").toExpression(), AssignmentOperatorType.ASSIGN, target.clone() .invoke(Pattern.ANY_STRING, new TypedLiteralNode("class", String.class).toExpression()) .withName("methodCall") .toExpression() ), new BackReference("fieldAccess").toExpression() ); return pattern; }