You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Vervoort, Claude" <Cl...@webct.com> on 2002/12/02 20:19:15 UTC

Implementing a new JavaGeneratorFactory - bug in Emitter???

Hi,

I've implemented a sub-class of JavaGeneratorFactory to be used with -f option of wsdl2java.

It's failing at runtime because the emitter is not set in the JavaGeneratorFactory instance when the generatorFactory is supplied in the command line (it is however set whithin the Emitter constructor which builds a default instance of JavaGeneratorFactory.). I fixed this by adding a setFactory() to the emitter that checks for the type of GeneratorFactory and set the Emitter if it's a JavaGeneratorFactory:

    /**
     * Default constructor.
     */
    public Emitter () {
        setFactory(new JavaGeneratorFactory(this));
    } // ctor

    /**
     * Set the emitter on the generatorFactory if the generatorFactory is an instance of JavaGeneratorFactory
     */
    public void setFactory(GeneratorFactory factory) {
        if (factory instanceof JavaGeneratorFactory)
            (((JavaGeneratorFactory)factory).setEmitter(this));
        super.setFactory(factory);
    }

That fixed it for me.

Is this a bug in the Emitter? If not then I guess I'll have to create my own sub-class for Emitter and WSDL2java to go around this.

Claude