2009/2/5 Trejkaz <trej...@trypticon.org> > > public class Activator extends DependencyActivatorBase { > > public void init(BundleContext c, DependencyManager m) { > > m.add(createService() > > .setInterface(FooService.class.getName(), null) > > .setImplementation(FooServiceImpl.class) > > .add > > (createServiceDependency().setClass(BarService.class).setRequired(true)) > > ); > > } > > } > > I think I'll hold off on using iPOJO heavily until this is possible, > because it's great! I've never been a huge fan of XML because people > seem to throw it around and try to pretend that it isn't API (Spring > is one of the greatest offenders here.) In reality it is just more > API, but which forces you to write your program in two languages. The > Java equivalent is even more compact than the XML, and Java is already > pretty verbose! > > I'll have my little complaint though. Fluent doesn't just mean it's > Java, it means when you read it out loud it almost sounds like > English. As such you'll notice that fluent APIs don't tend to use the > word "set" in the method names. > > e.g. this is fluent: > > assertThat(m, isEqualTo(n)); > > And this is fluent: > > m.add(new Service() {{ > withInterface(FooService.class.getName(), > null).andImplementation(FooServiceImpl.class); > withDependencyOn(BarService.class).required(); > withependencyOn(BazService.class, "(name=something)").temporal(); > }}); > > But the examples posted in this thread thus far, I would not fit into > the fluent category. They're more like a classical builder API. Not > that there's anything wrong with that, I just don't want to see people > start abusing terminology and then (slippery slope) 2 years down the > track the entire JRE is considered to be a fluent API. >
just curious, would you say this is fluent? http://code.google.com/p/peaberry/wiki/UserGuide (apologies for interrupting the DI dueling...) TX > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@felix.apache.org > For additional commands, e-mail: users-h...@felix.apache.org > > -- Cheers, Stuart