Sorry for not replying sooner. I have been enjoying my Christmas break.
Is it possible to obtain a result of the method and pass it to the helper class?
Not yet, althoguh I have given some consideration to implementing this feature. Note that it only makes sense to provide acess to the return value in a rule which employs location AT EXIT (equivalently AT RETURN).
My plan was to allow the special binding $! to be used in the body of AT EXIT rules to reference the value about to be returned. It is not too hard to implement -- it merely requires a little more smarts in the transformer when it is planting the trigger code. It shoudl be possible to use this in combination with a RETURN action i the rule body e.g.
IF $! > 100
DO RETURN 100
If you want this feature please raise a JIRA for it and I will consider it for inclusion in the 1.2.1 patch release.
This sounds good. I will submit a feature request, cause it would simplify things a lot.
For the moment I am using the following workaround:
in my helper class I created a method which accepts object, calls required method itself, obtains return value and returns it to the rule.
In the rule I use "return" to return the value obtained from the helper method.
The problem with this approach is that helper class should have all the required methods defined in itself (with all arguments) because it needs to call methods of the original object.
I guess the feature would be very helpful in various cases. For example, in my case I wanted to write rules to check whether all JDBC statements are properly closed. But JDBC statements are obtained from the Connection object (connection.prepareStatement()) and to track them I need to get access to the returned statement instance. The special binding $! would be very useful in this case.