Try eval. Just put everything in your if expression
into an eval:
when
so : SomeObject()
eval(MyEngine.staticMethod1(arg1, arg2) && (new
MyObject(param1, param2)).isConditionTrue() &&
so.getString().startsWith("a"))
Another workaround is use the predicate:
when
so : SomeObject()
SomeObject(a:attr->(/*boolean expression here*/))
SomeObject(a:attr->(/*another boolean expression*/))
note that the boolean expression can be ANYTHING, not
necessariely related to attr. The a:attr has to be
there to get past the parser. It is weird and not the
"right" way to do things, but I'm using it now instead
of eval because there are still problems with multiple
evals and line breaks and stuff.
So eventually, I hope we'd be able to do
when
eval(/*boolean expression*/)
eval(/*another boolean expression*/)
......
Hope that helps,
Yuesong
--- Dmitry Goldenberg
<[EMAIL PROTECTED]> wrote:
> The issue may not necessarily be the particular
> language constructs as
> much as having enough samples and best practices to
> infer how to get
> stuff done. This is especially true for a Java
> developer who is a
> novice to the wonderful world of rules :) I don't
> mind the learning
> curve as long as there are enough tools in the
> toolbox for me to get my
> job done.
>
> For example, how do I express the following logic
> through DRL? -
>
> SomeObject so =3D new SomeObject();
> if (MyEngine.staticMethod1(arg1, arg2) &&
> (new MyObject(param1, param2)).isConditionTrue()
> &&
> so.getString().startsWith("a"))
>
> I've gathered that
> customer : Customer( subscription =3D=3D
> "Silver" )
> is equivalent to
> Customer customer =3D new Customer();
> if
> (customer.getSubscription().equals("Silver")) { ...
>
> But how do I deal with static method invokations,
> passing parameters
> into constructors, and invoking methods other than
> getters?
>
> Thank you,
> - Dmitry
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com