sorry for opening yet another thread on some subject related to
XSD2JavaGenerator, but I'm finding all this out piecemeal while
experimenting.

The generated coding for the factory class is somewhat strange.
Consider the following extracts:

package generated;

public static final GeneratedFactory INSTANCE = 
generated.GeneratedFactory.init();

private static GeneratedFactory instance = null; 

public static GeneratedFactory init()
        {
                if (instance != null ) return instance;
                instance = new GeneratedFactory();

                // Create package meta-data objects
                instance.createMetaData();

                // Initialize created meta-data
                instance.initializeMetaData();
                
                // Mark meta-data to indicate it can't be changed
                //theGeneratedFactory.freeze(); //FB do we need to freeze / 
should we freeze ????

                return instance;
        }

public GeneratedFactory()
        {
                super(NAMESPACE_URI, NAMESPACE_PREFIX, "generated");
        }


Clearly, the factory is supposed to be a singleton but still has a public 
(instead
of protected) constructor. It is also not clear to me why there are two static 
references 
to that single instance. And why is the init() method public when it is 
supposed to be called 
exactly once during static initialization? Surely, these are just minor flukes, 
but together 
with the commented stuff about freeze(), it makes me wonder if the generator 
tool is still in 
a state of flux.

Is the generated coding reliable? Does anyone have practical experience with 
this?

-- Sebastian

Reply via email to