Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How can I introduce annotations with AspectJ?

Hello,

Have a look at this:
The Aspect:

package de.tutorials.aspectj;

public aspect AnnotationIntroductionAspect {
 declare @type: de.tutorials.aspectj.Bubu+: @Deprecated;
}
-> Every type derived from Bubu should have the @Deprecated Annotation


The Java Class:

package de.tutorials.aspectj;
public class Bubu {
 public static void main(String[] args) {
System.out.println(new Bubu().getClass().isAnnotationPresent(Deprecated.class));
 }
}
Prints: true

For further information please have a look at: http://www.eclipse.org/aspectj/doc/released/adk15notebook/annotations-declare.html

Kind regards,
Thomas

Diego Torres schrieb:
Hello, I want to introduce into a java code base some annotations with AspectJ. Can anybody help me with an example?
Regards in advance.

Diego


--
Diego Torres
LIFIA - Laboratorio de Investigación y Formación en Informática Avanzada
Facultad de Informática - Universidad Nacional de La Plata
Calles 50 y 115 La Plata - 1900 Argentina
Phone: +54 221 4228252 Ext: 220
e-mail: diego.torres@xxxxxxxxxxxxxxxxxxxxxx <mailto:diego.torres@xxxxxxxxxxxxxxxxxxxxxx>
------------------------------------------------------------------------

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



Back to the top