Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] [ot] Eclipse AspectJ code snippet


Alex,

No. At all the insert and update join points "this" is an instance of the SimpleInsurance interface. The argument passed however will be a Customer, Policy or Claim which is what we want to validate. The declare parents snippet on the previous page ensure they implement the RequiresValidation interface.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx

http://w3.hursley.ibm.com/~websterm/

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:        aspectj-users-bounces@xxxxxxxxxxx

To:        userAJ <aspectj-users@xxxxxxxxxxx>
cc:        
Subject:        [aspectj-users] [ot] Eclipse AspectJ code snippet


Hi!

Firstly, I would like to excuse myself for posting the question here, but I am not aware of any
other place where I can do it. Please feel free to point me to the correct direction.

Now, my question is about the code snippet at page 293 :

[quote]
The following pointcut and advice ensure that any time we try to insert or update a domain object
that requires validation, we first validate the object to make sure it satisfies the business
constraints:

pointcut insertOrUpdate(RequiresValidation domainObject) :
  (execution(* SimpleInsurance.insert*(..)) ||
   execution(* SimpleInsurance.update*(..)))
   && args(domainObject);
[/quote]

Wouldn't this be instead:

[code]
pointcut insertOrUpdate(RequiresValidation domainObject) :
  (execution(* SimpleInsurance.insert*(..)) ||
   execution(* SimpleInsurance.update*(..)))
   && this(domainObject); // <<< this instead of args
[/code]

thanks for understanding,

./alex
--
.w( the_mindstorm )p.

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top