It seems that there are 2 ways to instantiate objects that were
generated by jaxb:
- call their constructor
- call the create...() method on the ObjectFactory
Both of these seem to do the exact same thing. I'm curious, if there's
a factory, why are the constructors public? My problem is that I want
to only call the factory creation methods, and to not call the
constructors directly. That way I can sometimes return a subclass. But
sometimes I forget, and call the constructors directly, which in my
case is a bug. So I'd like to prevent myself from shooting myself in
the foot by making the constructors private. Is there a way to set all
generated classes to have private constructors?
Thanks
Lowell