Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] Getting annotations from AdviceElement

On Fri 13.Jun'08 at 15:53:29 +0100, Raffi Khatchadourian wrote:
On Fri 13.Jun'08 at 15:37:47 +0100, Andr? Restivo wrote:
On Fri, Jun 13, 2008 at 2:17 PM, Raffi Khatchadourian
<khatchad@xxxxxxxxxxxxxxxxxx> wrote:
On Fri 13.Jun'08 at 14:00:11 +0100, Andr? Restivo wrote:
I'm developing a plugin for eclipse and I need to get all
annotations present in an Advice.

Do you want the annotations associated with the declaration of the
advice, or are you looking for annotations existing within the advice
body?

With the declaration of the advice.

...

public boolean visit(MethodDeclaration methodDeclaration, ClassScope
	scope) { super.visit(methodDeclaration, scope);

	if (methodDeclaration instanceof AdviceDeclaration) {

		AdviceDeclaration ad = (AdviceDeclaration) methodDeclaration;

		MethodBinding aBinding = ad.binding;

		//You may be able to obtain annotation information using this
		//binding, not sure but give it a shot!
	}

	return false; //don't traverse further down the tree.

}

I think that this above method is a bit better than using regular
expressions, but one thing I neglected to mention is that an
AdviceDeclaration may have annotation nodes associated with it. That may
be the way to go.

Raffi


Back to the top