Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Get all joinpoints from aspect?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, this has been asked before. Your only chance is 1st to get hold of all
the classes in the system (e.g. by a staticinitialization(*) pointcut) and
then use the Java 5 reflection API to see if the class is annotated. Also
note that the Wanted type must have runtime retention.

Eric

Pavel Kusch wrote:
> Hello,
> 
> I would like to get a list of all classes that are annotated with
> @Wanted at runtime. Is it possible to use apectj for it? Something
> like to ask an aspect to return all joinpoints and from them I would
> get the classes. Annotated class and aspect below.   
> 
> Thank you,
> Pavel
> 
> 
> @Wanted
> public class MyClass {
> 	public void someMethod(){
>     }
> }
> 
> public aspect A {
> 
> 	pointcut p():
> 		execution(* *(..)) &&
> 		within(@Wanted *);
> 
> 	Object around() : p(){
> 		return proceed();
> 	}
> }
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users



- -- 
Eric Bodden
Chair I2 for Programming Languages and Program Analysis
RWTH Aachen University


-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.0.1 (Build 2185)

iQA/AwUBQrwfiMwiFCm7RlWCEQLtXgCgtnqeF9iSb3Bl+pzi8B+xckd/O5gAniZe
7oxsJ7P9Lf6Yt+rIQWv8p06K
=je6C
-----END PGP SIGNATURE-----



Back to the top