users@jaxb.java.net

Re: Mod change in MethodWriter.declareMethod

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 20 Nov 2006 12:28:21 -0800

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.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com