Re: [aspectwerkz-user] Modifying parameters...

"Jonas Bonér" <[email protected]> Wed, 1 Mar 2006 10:17:09 -0800
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <[email protected]>
Hi there.

This is what you want:
http://aspectwerkz.codehaus.org/new_features_in_2_0.html#Strongly_typed_proceed

Besides, actually working :-), (and being more elegant), it is much
more performant since no reflection is used - all is statically
compiled.


/Jonas

On 3/1/06, Corey Puffalt <[email protected]> wrote:
> 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
>


--
Jonas Bonér
Terracotta, Inc.

http://jonasboner.com
http://www.terracottatech.com