In a way, that looks a bit like a problem that may be better solved using APT
(Annotation Processing Toolkit) and Java SPI (Service Provider Interfaces).
Essentially, you'd use APT tools to compile-time list all classes with your
annotation and dump their names in the appropriate file in META-INF for
java.util.ServiceLoader to pick up all the classes.
AFAIK, there isn't a way to achieve what you're trying to do with AspectJ.
Le 14 août 2012 à 09:16, Jean-Jacques Peyronel a écrit :
> Hi all,
>
> I would like to generate a static arrays of annoted classes.
>
> For exemple :
>
> @PutInArray
> Class A
>
> @PutInArray
> Class B
>
> @PutInArray
> Class C
>
> Class Tools{
> static Class<?> getAllClasses() {
> throw new runtimeException("Not yet implemented");
> }
> }
>
> Do you have an idea how to make it by aspectj ?
>
> Best regards.
> Jean-Jacques.
>
> <jjpeyronel.vcf>_______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users