Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Semantics Question (What are the correct names for these pieces?)

Thanks Andy.

So where does the joinpoint fit into the picture below?? Is a joinpoint the runtime location of a pointcut? Kind of like an instance of a class (joinpoint) vs. a class definition (pointcut)??

Andy Clement wrote:
Hi,

2008/12/9 Jason Weinstein <Jason.Weinstein@xxxxxxx>:
  
What are the correct names for these pieces

Example

  public pointcut NormalizedMessage_new() :
      call(NormalizedMessage+.new(..));

  Object around() :
      NormalizedMessage_new() {
      logEntering(thisJoinPoint);
      return proceed();
  }

1. (pointcut - this one i can do)
  public pointcut NormalizedMessage_new() :

    
It is a named pointcut.  it has a pretty poor name though...  I'd
prefer something like
constructionOfNormalizedMessage() perhaps, something more readable.
The ability to name the pointcuts is a powerful feature that helps you
understand what the pointcut is trying to achieve - don't just
translate the pointcut body directly into a name.

  
2.
      call(NormalizedMessage+.new(..));
    
This is a kinded pointcut designator, the one named 'call' - which
selects call join points.  Typically you would include a scoped
pointcut designator, like within() or withincode() to limit where you
are looking for the call join points, but it is not always required.
You may also include some of the binding pointcut designators to
expose context from the join point (you might use args() to exposed
the arguments at the call).

  
3.
  Object around() :
      NormalizedMessage_new() {
      logEntering(thisJoinPoint);
      return proceed();
  }
    
This is around advice.  If you had a better pointcut name the
declaration may read a little more friendly:

Object around(): constructionOfNormalizedMessage() {

"around constructionOfNormalizedMessage"

  
4a.
  Object around() : NormalizedMessage_new()
    
advice declaration/signature.

  
4b.
      logEntering(thisJoinPoint);
      return proceed();
  }
    
advice body.  This around advice body uses a proceed to invoke the
originally matched join point.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
  

Back to the top