jo_atman Posted October 5, 2006 Share Posted October 5, 2006 Sorry about specifying a name in the subject, but i thought Teodor might be the best person to answer this:I noticed that JRBeanCollectionDataSource and others need the collection/array to be specified in the constructor. I was hoping i could use a setter to set my collection in, perhaps after creating the data source through a spring config file. I guess the question is whether there is a specific reason that we can't use a setter to set the collection in the datasource.Thanks,Nilesh Link to comment Share on other sites More sharing options...
Teodor Danciu Posted October 5, 2006 Share Posted October 5, 2006 Hi, There is no setter for the collection because it did not make sense, at least given the purpose we had in mind for it when we created it.These implementations serve only for wrapping data and make it behave like a JR data source. That is all we intended for them.Now you say you want to use them for something they were not meant to be. Spring beans. I don't see any problem in having your own Spring bean into which you inject the Collection, and have another getter that takes the injected collection, wraps it into our data source implementation and passes it to the report filling process.Also, having a setter method like this would be confusing because users might think they can change the collection at any moment, even during iteration. Thank you,Teodor Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now