Not an inner class, the class definition would not have to be within the parent.

An example of how it works now:


  | @Stateful
  | @Name("productSearcher")
  | public Class ProductSearcherImpl....{
  | 
  |   @DataModel
  |   private List<Product> searchResults;
  | 
  |   private List<ProductFilter> filters = new ArrayList<ProductFilter>();
  | 
  |   @Create
  |   public void init(){
  |     for(ProductCategory category: categoryDAO.list()){
  |       ProductCategoryFilter filter = 
Component.newInstance("productCategoryFilter");
  |       filter.setCategory(category);
  |       filters.add(filter);
  |     }
  |   }
  | 
  |   @Factory("searchResults")
  |   public void search(){
  |     searchResults = ...
  |     for(ProductFilter filter: filters){
  |       filter.apply(searchResults);
  |     }
  |   }
  | 
  | }
  | 

To me at least this is bad.  Every time I call Component.newInstance() I 
outject the created filter.  Since the Filter is never used outside of the 
containing SFSB, I don't want it oujected.  What I do want is for each filter 
to recieve injection from the associated contexts AND be allowed to outject 
values into those contexts.  What I was thinking would look like this:


  | @Stateful
  | @Name("productSearcher")
  | public Class ProductSearcherImpl....{
  | 
  |   @DataModel
  |   private List<Product> searchResults;
  |    
  |    @ChildComponent
  |   private List<ProductFilter> filters = new ArrayList<ProductFilter>();
  | 
  |   @Create
  |   public void init(){
  |     for(ProductCategory category: categoryDAO.list())
  |       ProductFilter filter = new ProductFilter(category);
  |   }
  | 
  |   @Factory("searchResults")
  |   public void search(){
  |     searchResults = ...
  |     for(ProductFilter filter: filters){
  |       filter.apply(searchResults);
  |     }
  |   }
  | 
  | }
  | 

Does that make more sense?

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967896
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to