Change structure of generated code for extensible matcher to include a
nested class and static factory methods in all cases.