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

iradix do-not-reply at jboss.com
Thu Aug 3 13:17:02 EDT 2006


Now that I've been using Seam for a while, I wanted to point out a couple of points that I've had trouble with or thought might be useful enhancements just to see if anyone else out there agrees/disagrees/or has any suggestions of alternatives.

1)I haven't found a good way to instantiate multiple, unique Seam  components of the same type.  As a use case say that I have a ProductFinder  SFSB that uses multiple CategoryFilter objects to narrow down a result list.  I can't create a subclass of CategoryFilter for each type of category because the categories are dynamically defined, and I'd like them to be Seam components so that they can take advantage of bijection and all the other Seam goodies.  What I've been doing in this situation is using Component.newInstance(), but besides the fact that Gavin indicated that wasn't a great idea, it doesn't really seam suited to the task anyway.  For one thing, newInstance() will cause an outjection of the created component after it is created, which is not really something I'm interested in for this scenario.  Why clutter up any context when the bean is just used internally by the containing class?  This isn't much of a problem with EJBs since they can be retrieved outside of seam and still be intercepted, but  how about a method like  T Component.newInstance(Class beanClass) to instantiate a CGLIB enhanced bean of any class with a no-arg constructor?  The instantiated bean wouldn't even have to be named since it won't be outjected. Or at least public access to the methods on Component necessary to do something like that would be helpful. 

2) Wouldn't the ability to define an automatic naming convention be nice?  Something like the type of pattern Log4J gives you to output a portion of a class name?  Generally, I'm naming all of my beans to be the camel case class name with a lowercase first character and this would help with refactoring as well as stupid mistakes like copying a similar object and forgetting to change the name.  Hopefully I'm not the only one who does things like that.  Basically, all you would have to do is give the component a @Name annotation with no value to get the default.  I'd imagine the naming convention could be defined in seam.properties.


Anybody else interested?


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

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




More information about the jboss-user mailing list