Pergunta

I have several functions which receive Strings as parameters. I need to create a pointcut that captures one of those parameters. This parameter is in different order in the different functions, but it's always called idTaller.

This is what I have tried so far:

public aspect TallerWSAspect {
    pointcut webservice(String idTaller) : execution(!static public * TallerWS.*(String,..)) && args(idTaller,..);
    }   
}

This pointcut captures a method whose first parameter is a String, and captures it with the name idTaller.

Is there a way to select which parameter I want to capture?

Foi útil?

Solução

i think you can only capture by type as per

https://eclipse.org/aspectj/doc/next/quick5.pdf

however, you can use reflection in aspects to read the parameters, and pick out the one you want.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top