Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Weaving code that comes from an Annotation's value

Hi, 

I'd like to be able to annotate my methods with code that should then always
be called before the method itself is called. Is it, through AspectJ,
possible to treat the value of a (String) element of an annotation as code?

For example: 
public interface Foo {
	@ExecuteBefore("System.out.println('hi');");
	public void foo();
}

I now want System.out.println('hi') to always be called before the
implementation of foo() is called. You might recommend using abstract
classes in this case, but this is just an extremely oversimplified example
to show you what I mean and using abstract classes or anything similar won't
help me, unfortunately. 

Thank you very much for your time
Michael Herrmann

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++


Back to the top