I have the next JInvocation:
JInvocation jInvoke = JExpr.invoke(anotherPageInstance, method);
where anotherPageInstance
is JVar
and method is JMethod
.
I do some actions on this JInvocation
, and then I want to add it to test.body().invoke
where test is JMethod
.
The main problem is that I can't, because test.body().invoke
has no option to get JInvocation
as argument.
I can do the next: test.body().invoke(anotherPageInstance, method)
, but this doesn't help me, because I want to save the JInvocation
, and just when some conditions are taking place, add this Jinvocation
to the body (and as I mentions before, meanwhile I do some action on this JInvocation
).
Any help?
You can add an invocation the body (
JBlock
) by using theadd()
method: