Hi.

I put together my own GeneratorFactory to use with WSDL2Java.  However, I simply 
wanted to subclass JavaGeneratorFactory, which wasn't working since
the current behavior calls the noarg constructor.  This patch ensures that custom 
GeneratorFactories are initialized with an Emitter if they have a
constructor which accepts and Emitter.

If need be, I'll post this patch to Bugzilla, but figured I'd start here.  See below 
for patch...

Cheers,
--Doug

Doug Bitting
Agile Software
1 Almaden Blvd
San Jose, CA  95113
(408) 999-7120

---- snip here ----
Index: wsdl/toJava/Emitter.java
===================================================================
RCS file: /home/cvspublic/xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
retrieving revision 1.50
diff -r1.50 Emitter.java
60a61,62
> import java.lang.reflect.Constructor;
> 
285,286c287,299
<             setFactory((GeneratorFactory)
<                        ClassUtils.forName(factory).newInstance());
---
>             Class clazz = ClassUtils.forName(factory);
>             GeneratorFactory genFac = null;
> 
>             try {
>                 Constructor ctor = 
>                     clazz.getConstructor(new Class[] { getClass() });
>                 genFac = (GeneratorFactory) 
>                     ctor.newInstance(new Object[] { this });
>             } catch (NoSuchMethodException ex) {
>                 genFac = (GeneratorFactory) clazz.newInstance();
>             }
> 
>             setFactory(genFac);

Reply via email to