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