This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
So then what exactly do you mean by middle parameter? How many parameters?
If ther eis nothing to grab onto, some pattern, that is where I find creating my own Annotation and creating a Pointcut that matches the methods. But I think that might still nto completely solve your problem, which only leaves creating pointcuts that combine pointcuts with &&(and), || (not), ! (or)
Joined: Feb 23, 2009
Mark Spritzler wrote:So then what exactly do you mean by middle parameter?
Middle means anything except of first and last - no matter how many parameters are present.
Creating annotation and marking all methods that fit my requirement is a solution with some limitations.
What if there are a lot of methods? If my pattern changes I need to look through all annotated methods.
What if these methods are not in my classes (that's why I cannot edit them).
So I want to do it in by one pointcut without editing classes.
Besides, this information can be successfully calculated without any marking. When argument is first and last it is very easy.
Why this cannot be easy for middle argument?
Did you get a solution for this issue ? Please update.
I came up with a workaround for this. Since i know the number of arguments the method (inherited from interface) will take, i used * in place of other arguments and named the parameter of my concern. Then i was able to use it.
this worked for me.
Please update if you have found a way to fix this, if the number of arguments is unknown.