Jump to content
Changes to the Jaspersoft community edition download ×

Teodor: question about JRDataSource


Recommended Posts

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.



Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic



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,


Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...