Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Determination of interface implementation in apointcut

Neil, it sounds like you want a pointcut based on static types, such as:

// match execution of any method *defined in* a type that implements
Interface
pointcut execWithinInterface() :
  within(Interface+) && execution(* *(..)); 

or

// matches execution of any method declared by Interface or its implementers
pointcut execInterfaceExtensions() : 
  execution(* Interface+.(..));

class B {
   void foo() {} // matches neither
}

interface Interface {}

class D implements Interface {
   void foo() { super.foo(); } // matches both
   void bar() {} // matches both
}

These two pointcuts do differ in how they match inter-type declarations.

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Neil Redding
Sent: Saturday, August 19, 2006 10:58 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] Determination of interface implementation in
apointcut


I need to test whether a joinpoint is a member of a class that
implements a particular interface, and would like to avoid a runtime
test to determine this if possible. I'm currently using the "this()"
pointcut, but have also tried "target()" - both seem to require runtime
tests. 

Also, I want to exclude joinpoints in base classes of classes that
implement the target interface; at the moment neither of the above
pointcut primitives are doing this. 

Any advice?

Thanks,
Neil

------------
Neil Redding
Director
Lab49, Inc.

Phone: 646.291.2868
Email: nredding@xxxxxxxxx
Web  : www.lab49.com
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top