[aspectwerkz-user] Initializing references from a "before" aspect
"Hindin, Avi" <[email protected]>
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <F8B9B12641FB6B4FAC761BDEF9D63B040503E783@tlv-ex-01.adprod.bmc.com> |
Hi guys,
My aim is to write a "before" aspect that initializes a reference passed to
the original method as null.
That is, what I logically want to do in the aspect is:
myMethod(String str)
{
// "before" aspect should do the following:
If(str==null)
str = "abc";
// applicative logic here ....
}
All this is well, but, of course, does not work. Why? Because AspectWerkz
implements "before" aspects by calling
an automatically generated method to do the work (example below) and you
cannot, of course, initialize a reference
within a method.
But is there a workaround? Please notice that such a workaround cannot
involve attaching the aspect
to code _callng_ the method, since that code is not available to me.
Your help will be highly appreciated!
Avi Hindin
BMC Software