users@jaxb.java.net

RE: Re: Mod change in MethodWriter.declareMethod

From: <HeruMartinus.Salim_at_infineon.com>
Date: Tue, 21 Nov 2006 16:23:16 +0100

 

> -----Original Message-----
> From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
> Sent: Monday, November 20, 2006 9:28 PM
> To: users_at_jaxb.dev.java.net
> Subject: Re: Mod change in MethodWriter.declareMethod
>
> HeruMartinus.Salim_at_infineon.com wrote:
> > Hi,
> >
> > I'm trying to declare a method using MethodWriter.
> >
> > JMethod $calculate = writer.declareMethod(codeModel.INT,
> "calculate");
> > JVar $parameter = writer.addParameter(String.class, "value");
> >
> > But I can't find the declareMethod method variant with
> access modifier
> > (Public/protected/private) as parameter.
>
> It doesn't make sense to have such method, because
> MethodWriter is for abstracting away the difference between
> interface/impl vs beans generation style.
>
> You cannot define any non-public stuff on interfaces.
>
> If the goal is to define methods just on impl classes or
> value classes, you should be using JMethod and JDefinedClass
> directly, as Lexi explained.
>

What should I do if I want to define additional enum on impl classes,
which will be used by the beans generation?
Because the beans generation (onActivated method) is done before the
impl class (run method), I couldn't get the enum I added to the impl
classes from the beans generator.

Can I change the way it works? Or are there any other ways?
Or can I add the enum on the fieldRenderer scope?

Regards,
Heru