users@jaxb.java.net

CodeModel

From: <HeruMartinus.Salim_at_infineon.com>
Date: Thu, 16 Nov 2006 19:13:11 +0100

The problem has been solved.
I inherit all the classes/interfaces inside the
com.sun.tools.xjc.generator.bean.field package.

Now I have problem by using JCodeModel.
Can someone help my to use it?

JClass iteratorType =
codeModel.ref(Iterator.class).narrow(exposedType.boxify());
      
$get = writer.declareMethod(iteratorType,"get"+prop.getName(true));
JBlock block = $get.body();
fixNullRef(block); // avoid using an internal getter
block._return(acc.ref(true));


The code above resulting the code of

public Iterator<Signals> getSignals() {
     if (signals == null) {
                     signals = new ArrayList<Signals>();
     }
     return this.signals;
}

But I want to change the return statement into

return this.signals.iterator();

I've tried many possibilities, but still cannot solve this thing.

Thanks.
Regards,
Heru
        
 

> -----Original Message-----
> From: Salim Heru Martinus (IFAG COM BTS MT SD)
> Sent: Thursday, November 16, 2006 2:00 PM
> To: users_at_jaxb.dev.java.net
> Subject: RE: Re: XJC error message -> extends SingleField
>
> Can we bypass calling the constructor of SingleField inside
> the MySingleField (it's subclass).
> Because when the constructor of SingleField was called, all
> the code was already there eventhough I don generate any code
> from MySingleField.
>
>