incubator-graffito-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Connelly <dsconne...@adelphia.net>
Subject Why doesn't OjbectConverter getObject call this.newInstance method ?
Date Tue, 12 Sep 2006 20:09:08 GMT
All:

I do a pm.save on the root of my model objects.   Then I want to fetch 
the object model back using some code like:

    RootClass root = (RootClass) pm.getObject("/test.root");

This fails because my model uses a factory class, not constructors, to 
instantiate model objects, including instances of the RootClass.

This pm is constructed using my custom MyObjectConverterImpl, which is a 
subclass of ObjectConverterImpl.   I expected that this would give me a 
way to control object creation.    It seems that I was wrong (unless I 
copy major portions of ObjectConverterImpl).

ObjectConverterImpl, if I delegate getObject to it, attempts to get a 
root object using this code:

       Object root = 
ReflectionUtils.newInstance(classDescriptor.getClassName());

That causes the failure.   ReflectionUtils is out of my control.   
ObjectConverterImpl does not invoke *this.newInstance* so that 
MyObjectConverterImpl can get control back for the construction in my 
objects (using my factory class).

What are the plans, if any, are there to accommodate object models which 
use a factory class for construction of its objects?

       -- Dan




Mime
View raw message