This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I have a SessionScopedManagedBean that holds an ArrayList of a custom class. In my facelet I reference this custom class in components. I previously had this custom class defined as a sub-class of my bean:
But the codebase for the custom class is getting complex and so I moved it to its own file. This appears to work. So my question is should I have declared this custom class as a bean since it has get/set methods and if so how would I instantiate it in my SessionScoped bean class since this will be inside a List?
CustomClass is a bean (POJO), and always has been a bean, although perhaps not literally a POJO, since it was an embedded class.
I think what you're asking is should it be a Managed Bean. And the answer to that is no.
A Managed Bean isn't a class, it's a unique instance of a class, accessible by name and constructed automatically by JSF.
Since CustomClass is not being used as a single unique instance - instead you have an entire collection of CustomClass objects, the bean management mechanisms would only apply if you went to the not-inconsiderable effort of adding a whole lot of managed CustomClass instances to your faces-config file (Annotations can't deal with multiple instances), and then fed the references to all those instances to the target bean's constructor as a managed collection property. Which is probably not going to be flexible enough for most purposes.
Customer surveys are for companies who didn't pay proper attention to begin with.