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

Hi

Thanks guys...
I guess I should do a better google search next time?

/Jeppe

Dean Wampler wrote:
Yes, you can "declare annotation". Here's the relevant manual page with the particulars. The examples are even very close to your example!

http://www.eclipse.org/aspectj/doc/released/adk15notebook/annotations-declare.html

dean

Jeppe Cramon 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


--
Dean Wampler's Signature Dean Wampler, Ph.D.
dean at aspectprogramming.com
objectmentor.com
aspectprogramming.com
contract4j.org

I want my tombstone to say:
Unknown Application Error in Dean Wampler.exe.
Application Terminated.


__________ NOD32 2080 (20070225) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com

_______________________________________________ aspectj-users mailing list aspectj-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/aspectj-users __________ NOD32 2080 (20070225) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com