{"action":"created","issue":{"url":"https://api.github.com/repos/pinterest/secor/issues/60","labels_url":"https://api.github.com/repos/pinterest/secor/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/pinterest/secor/issues/60/comments","events_url":"https://api.github.com/repos/pinterest/secor/issues/60/events","html_url":"https://github.com/pinterest/secor/pull/60","id":50872438,"number":60,"title":"Changed the FileReaderWriter class to a factory based implementation","user":{"login":"silasdavis","id":99715,"avatar_url":"https://avatars.githubusercontent.com/u/99715?v=3","gravatar_id":"","url":"https://api.github.com/users/silasdavis","html_url":"https://github.com/silasdavis","followers_url":"https://api.github.com/users/silasdavis/followers","following_url":"https://api.github.com/users/silasdavis/following{/other_user}","gists_url":"https://api.github.com/users/silasdavis/gists{/gist_id}","starred_url":"https://api.github.com/users/silasdavis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silasdavis/subscriptions","organizations_url":"https://api.github.com/users/silasdavis/orgs","repos_url":"https://api.github.com/users/silasdavis/repos","events_url":"https://api.github.com/users/silasdavis/events{/privacy}","received_events_url":"https://api.github.com/users/silasdavis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2014-12-03T18:17:17Z","updated_at":"2015-01-21T16:28:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pinterest/secor/pulls/60","html_url":"https://github.com/pinterest/secor/pull/60","diff_url":"https://github.com/pinterest/secor/pull/60.diff","patch_url":"https://github.com/pinterest/secor/pull/60.patch"},"body":"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.\r\n\r\nThis maintains the ability to specifiy a single factory class that generates readers and writers (see the SequenceFileReaderWriterFactory class). The standard way to implement would be to provide the reader and writer implementation as nested classes as I have done with the existing SequenceFile and DelimteredTextFile ones.\r\n\r\nI'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.\r\n\r\nUnavoidable its a big PR, but the main entry point is: src/main/java/com/pinterest/secor/io/FileReaderWriterFactory.java\r\n\r\nAll 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)."},"comment":{"url":"https://api.github.com/repos/pinterest/secor/issues/comments/70869119","html_url":"https://github.com/pinterest/secor/pull/60#issuecomment-70869119","issue_url":"https://api.github.com/repos/pinterest/secor/issues/60","id":70869119,"user":{"login":"silasdavis","id":99715,"avatar_url":"https://avatars.githubusercontent.com/u/99715?v=3","gravatar_id":"","url":"https://api.github.com/users/silasdavis","html_url":"https://github.com/silasdavis","followers_url":"https://api.github.com/users/silasdavis/followers","following_url":"https://api.github.com/users/silasdavis/following{/other_user}","gists_url":"https://api.github.com/users/silasdavis/gists{/gist_id}","starred_url":"https://api.github.com/users/silasdavis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silasdavis/subscriptions","organizations_url":"https://api.github.com/users/silasdavis/orgs","repos_url":"https://api.github.com/users/silasdavis/repos","events_url":"https://api.github.com/users/silasdavis/events{/privacy}","received_events_url":"https://api.github.com/users/silasdavis/received_events","type":"User","site_admin":false},"created_at":"2015-01-21T16:28:37Z","updated_at":"2015-01-21T16:28:37Z","body":"I've just squashed the commits and rebased off master"}}