[jboss-user] [JBoss Seam] - Re: A couple of observations

iradix do-not-reply at jboss.com
Fri Aug 4 11:08:51 EDT 2006


anonymous wrote : 1) Use @Roles

Roles are only useful if you can choose unique names at compile time.  In the use case I gave, the filters are built on categories which are dynamically defined through the application so roles won't work.  I've got code that looks something like:

List<ProductFilter> filters = new ArrayList<ProductFilter>();
  | for(ProductCategory category: categoryDAO.list()){
  |   ProductCategoryFilter filter = Component.newInstance("productCategoryFilter");
  |   filter.setCategory(category);
  |   filters.add(filter);
  | }

Besides the fact that Component.newInstance() will outject the created components one after the other, which isn't necesary in this case and might be a problem if I did have a productCategoryFilter outjected to a context for some reason, it also won't do any unwrapping.  There just really doesn't seem to be a good way to simply instantiate a seam component so that it is intercepted when you don't need retrieval from a context or outjection to a context and I think this is useful, especially with POJOs.

anonymous wrote : 2) Yes, this would make sense but .... we would need to introduce an @Component annotation

Sounds good to me.  Out of curiosity though, why wouldn't @Name with no value attribute work?



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963218#3963218

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963218



More information about the jboss-user mailing list