Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Signature represents top-level class

I was hoping someone might be able to explain a) why when I call thisJoinPoint.getSignature().toLongString() I get the full method signature for the top-level parent and b) how I might instead obtain the signature of the actual instance on which the pointcut matched.

Let me provide some code in case I'm not being clear.

I have an Aspect like such...

public aspect MyAspect {
    pointcut MyImpl()
        : execution(* *(..)) && this(com.sarah.MyImpl);

    before() : MyImpl() {
        System.out.println(thisJoinPoint.getSignature().toLongString());
    }
}

And I have a top-level parent class like...

public abstract class MyParent {
    public abstract void someMethod();
    public void invoke() {
       ... do some simple stuff...
    }
}

And I have an implementation of the abstract class like...

public class MyImpl extends MyParent {
    public void someMethod() {
        // whatever
    }
}

When I run this code and call myImpl.invoke(), the Aspect prints out...
 public void com.sarah.MyParent.invoke()

Ideally I'd like to get public void com.sarah.MyImpl.invoke() instead.

Apologies if this is common knowledge, but I can't seem to find information on this anywhere.  (BTW, I'm subscribed to this email list, but I get rejected when I try to search old emails from the website.  Anyone know about that too?)

Thanks all!

------------------------------
Sarah Haskins
Software Development
sarah.haskins@xxxxxxxx
Sakonnet Technology
594 Broadway, Suite 1008 
New York NY 10012
www.sknt.com
+1 917 237 38__ direct 
+1 212 343 3103 fax


_______________________________________________________
This message is for the named recipient's use only.  It may contain sensitive and private proprietary information.  No confidentiality is waived or lost by any incorrect transmission.  If you are not the intended recipient, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender.  You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient.  Sakonnet Technology, LLC and its subsidiaries reserve the right to monitor all e-mail communications through their networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity.  Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to our formal written confirmation. 



Back to the top