I forgot to mention, but another part of the reasoning here is that Java 8 is (finally!!!) allowing static methods in interfaces, so the "natural" pattern for this sort of thing would just be Interface.create(...), and while we won't be able to use that for a while, the Interface.Factory.create(...) option is about as idiomatically close to that as we can get in Java 7.
--Rafael On Tue, Apr 29, 2014 at 2:57 PM, Rafael Schloming <[email protected]> wrote: > Hi Everyone, > > I've put together a patch that makes the proton-j factory usage a bit > simpler and more consistent. You can review it here if you like: > > - https://reviews.apache.org/r/20854/ > > The main point of the patch is to make all the factories consistently > follow this pattern: > > package.Interface iface = package.Interface.Factory.create(...); > > I like this because it is simple and easy to remember and doesn't require > importing the impl packages directly. > > The patch preserves the convenience constructors, e.g. Proton.connection() > and so forth, but it does remove the old factory APIs. I think this is a > reasonable thing to do because the old factories were cumbersome enough to > use that I don't think anyone actually bothered (including our own > exmaples). > > In any case, please shout if this patch will be troublesome for you. If I > don't hear anything I'll go ahead and commit it later this week. > > Thanks, > > --Rafael > >
