I was wondering if instead of passing the Abdera instance around all the time on the request instance, if we could just inject it into providers instead. While theoretically we could have a single provider serve multiple Abdera instances, I don't really think its that likely. People may do it, but I think the majority of people won't.

If we could do something like Provider.setAbdera(abdera) it would make access to the Factory quite a bit easier as well. For instance, inside the CollectionProvider bits I have to do this currently:

 @Override
public List<Person> getAuthors(Customer entry, RequestContext request) throws ResponseContextException {
   Person author = request.getAbdera().getFactory().newAuthor();
   author.setName("Acme Industries");
   return Arrays.asList(author);
 }

Now contrast it to what it could be if we had a 1:1 relationship between an Abdera instance and a Provider/CollectionProvider:

 @Override
public List<Person> getAuthors(Customer entry) throws ResponseContextException {
   Person author = getFactory().newAuthor();
   author.setName("Acme Industries");
   return Arrays.asList(author);
 }

It's not life changing, but its cleaner as the RequestContext doesn't need to be passed to get the authors. It would also make the AbstractCollectionProvider a fair bit cleaner.

Thoughts?

- Dan

--
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog

Reply via email to