在AOP切入点中使用正则表达式?

时间:2014-07-31 08:50:09

标签: java regex aop aspectj

我是从AOP开始的。我希望在以#34; start"开头的MainMenuActivity类的每个方法之前执行beforeStart()。像这样:

@Before("call(void " + packaging + "MainMenuActivity.startCrearParte())" +
            " || call(void" + packaging + "MainMenuActivity.startAsignar())" +
            " || call(void" + packaging + "MainMenuActivity.startCargaTrabajo())" +
            " || call(void" + packaging + "MainMenuActivity.startAsignados())" +
            " || call(void" + packaging + "MainMenuActivity.startFinalizadosNoEnv())" +
            " || call(void" + packaging + "MainMenuActivity.startSincronizar())"
    )
    public void beforeStart() {
        //DO SOMETHING
    }

我可以使用正则表达式吗?谢谢!

1 个答案:

答案 0 :(得分:0)

您可以使用通配符:

@Before("call(void " + packaging + "MainMenuActivity.start*())")

请参阅http://www.eclipse.org/aspectj/doc/released/progguide/semantics-pointcuts.html