Niclas Hedhman wrote:
> But then you still end with a lot of lines of code to set up the Pojo.
>
> So, all in all, I think that custom made factories seems to be the
> simplest way forward. But I wanted to elaborate on my thinking, and
> asking if anyone else see some other way that is better....
Yeah, I have been thinking about this too, and I can't come up with a
better solution than what you ended up with, and as Richard outlined:
having factory service with one method per value object, which can then
be injected as a whole or per-type:
interface ValueFactoryService
extends AValueFactory, BValueFactory, CValueFactory, ServiceComposite {}
interface AValueFactory
{
A create(String some, int value);
}
public class ValueFactoryServiceMixin
implements AValueFactory, BValueFactory, CValueFactory
{
A create(String some, int value)
{
..
}
.. more value creation methods ..
}
So for each value you would create one new creation interface and new
methods in the already existing value factory implementation (so no need
for loads of factory classes). I think this is the best way to do it.
This will allow for strategies in the factory to do caching of value
objects as well if you want to.
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev