samedi 18 mars 2017

Convert aspect to native AspectJ notation

I have this aspect:

public privileged aspect Teste {
private ISupermarket supermarket;

@AfterReturning(pointcut = "execution(* ca1.business.SupermarketFactory.createSupermarket(..))", returning = "result")
    public void afterCreateSupermarket(JoinPoint joinPoint, Object result) {
        supermarket = (ISupermarket) result;
    }
}

The thing is that I want to code it in native AspectJ notation.

I searched but the closest I got was to this:

void after() returning(result) : pointcut(* ca1.business.SupermarketFactory.createSupermarket(..)) {
    supermarket = (ISupermarket) result;
}

But this gives me some errors because it is not well coded.

Can anyone help me with this?





Aucun commentaire:

Enregistrer un commentaire