pinterest/secor — pull request #60 by silasdavis (2014-12-03 18:17:17+00:00)
Title: Changed the FileReaderWriter class to a factory based implementation

The more I thought about the FileReaderWriter implementation the more I thought it was an example of stringly typing (only with a enum). I really think it is a bit of a code smell so I refactored it into a Factory-based implementation.

This maintains the ability to specifiy a single factory class that generates readers and writers (see the SequenceFileReaderWriterFactory class).

I've made all the tests pass, but I'm sure there's some cleaning up to do. I just wanted to show it to you early to see what you think.

Unavoidable its a big PR, but the main entry point is: src/main/java/com/pinterest/secor/io/FileReaderWriterFactory.java

All changes cascade from that. The nice thing about this is you have the intialisation method directly on the factory, so implementers know exactly what to implement and the type system enforces this. The only reflection is to create the factory (which requires a parameterless constructor).