Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Intertype definitions and annotations

There's the "declare annotation" feature which does exactly that.

Eric

On 2/25/07, Jeppe Cramon <jeppe@xxxxxxxxx> wrote:
Hi

I'm pretty this is not possible, but I wanted to hear it from the really
experienced guys.
Is it possible using intertype definitions to enhance/decorate
classes/fields/methods with annotations...?

Exmaple: I have a web application where the infrastructure uses a
@Secure annotation to define access control to Controllers.
Since we have a lot of Controllers neatly placed in meaningfull
packages, I wanted to define an Aspect where I could say all Controllers
(there's an interface you can use to spot them out), that are in the
com.mycompany.web.admin should have
@Secure(roles="ROLE_ADMIN") added to their class declaration and all in
package com.x.y should have @Secure(roles="ROLE_USER") finally the rest
should be left alone.

The alternative way would be to write an Aspect that worked with the
security infrastructure and used the packages to define the required
roles, but just out of curiosity I would like to know if the other
solution is at all possible (for cases where you have to play by the rules
and apply the annotations as the framework expects) ?

/Jeppe


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



--
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


Back to the top