[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] Accessing the target from within @Around
|
- From: Andrew Eisenberg <andrew@xxxxxxxxxxxx>
- Date: Wed, 19 Aug 2009 15:43:00 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:reply-to:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=e+GaeotBrnPGDfwMdwgpnEva2LDQyshEXkhTq/3XAxo=; b=nNYfuP/9pQcy29+zBKhD+ynLC6edCzqaVvRpEm+43TCiKNl3r13iz7CGAJKVfQSluT r7zUyuJF3M4jT6H0l5KPnfkjGufwy1zww3XuhqACuJvSCgtTV2CAVuwiphJQaZ2YBLbu XF890l52Mq9CQSrvm5Cwy5Nrh7PYv4Pgm2Wdc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=uq2wykA0Zoe6WPUoTxXnqg+dWOBrPKjTROqbSLQSBuuuQtVV1S4Ztd1lTDkJNiPLoY iAbtBTAhwUDWhKOum80dqNpWcHEIaJcbrJ16N9KWU5tSdLRPbm+sc1kasFwCzoTQVcEv wvZYZNh14MIHQHdY4mR/bHw2eZY3jcH+aQu/c=
Yes, there is. See here for the details:
http://www.eclipse.org/aspectj/doc/released/adk15notebook/ataspectj-pcadvice.html
You can do something like
@Around("execution(void com.example.jobs.FooJob.run()) && this(job)")
public void retryJob(ProceedingJoinPoint join_point, FooJob job)
throws Throwable {
On Wed, Aug 19, 2009 at 3:09 PM, Norman Elton<normelton@xxxxxxxxx> wrote:
> Suppose I've got the following simple wrapper around a Job's run() method:
>
> @Aspect
> public class JobWrapperAspect {
> @Around("execution(void com.example.jobs.FooJob.run())")
> public void retryJob(ProceedingJoinPoint join_point) throws Throwable {
> System.out.println("About to run a FooJob");
> join_point.proceed();
> System.out.println("Done running a FooJob");
> }
> }
>
> That's pretty straightforward, and works well.
>
> But is there any way to access the job object from within my advice?
> Something like...
>
> System.out.println("About to run a " + job.toString());
> join_point.proceed();
> System.out.println("Done running a " + job.toString());
>
> Any ideas? How do I access the "job" object?
>
> Thanks!
>
> Norman
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>