[aspectwerkz-user] Modifying parameters...
"Corey Puffalt" <[email protected]> Wed, 1 Mar 2006 10:40:13 -0700
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
All,
I'm attempting to use Aspectwerkz to modify the parameters being passed into
a method. This is using runtime weaving and an around advice under JDK1.5.
The advice is getting called fine but calling MethodRtti.setParameterValues()
doesn't actually appear to modifying the parameters. Is this known to
work? There don't seem to be any examples of doing this and the
documentation is rather spotty on the subject. Is there a better way?
My aop.xml file looks similar to this:
<!DOCTYPE aspectwerkz PUBLIC
"-//AspectWerkz//DTD//EN"
"http://aspectwerkz.codehaus.org/dtd/aspectwerkz.dtd">
<aspectwerkz>
<system id="webapp">
<aspect class="com.package.Aspect">
<pointcut name="method" expression="execution(*
com.package.Class.method(..))"/>
<advice name="modifier" type="around" bind-to="method"/>
</aspect>
</system>
</aspectwerkz>
My advice method looks something like this:
public void modifier(JoinPoint join)
{
[determine proper parameters]
Object[] values = { parm1, parm2, parm3};
((MethodRtti)join.getRtti()).setParameterValues(values);
return join.proceed();
}
Any ideas on what I'm doing wrong?
Thanks,
Corey