[rules-users] Static Imports

Meeraj Kunnumpurath mkunnumpurath at googlemail.com
Sun Jul 18 14:49:45 EDT 2010


And it works :)

On Sun, Jul 18, 2010 at 7:47 PM, Meeraj Kunnumpurath <
mkunnumpurath at googlemail.com> wrote:

> Thanks.
>
> In fact, I found this in the documentation, trying to follow your advice on
> using DRL functions
>
> <quote>
>
> Alternatively, you could use a static method in a helper class, e.g.,
> Foo.hello(). Drools supports the use of function imports, so all you would
> need to do is:
>
> import function my.package.Foo.hello
>
>
> </quote>
>
> Regards
> Meeraj
>
>
> On Sun, Jul 18, 2010 at 6:53 PM, Wolfgang Laun <wolfgang.laun at gmail.com>wrote:
>
>> Regretfully, no: import static is not implemented.
>>
>> Consider using a DRL function to wrap the call of the static method,
>> to achieve a shorter call.
>>
>> -W
>>
>> 2010/7/18 Meeraj Kunnumpurath <mkunnumpurath at googlemail.com>:
>> > Hi,
>> >
>> > Are static imports as shown below allowed in rule files? It is giving me
>> a
>> > parse exception.
>> >
>> > package mypackage;
>> >
>> > dialect "mvel"
>> >
>> > import mypackage.CreditTransferTransactionInformation10;
>> > import static mypackage.ValidationHelper.invalidate;
>> >
>> > global java.util.Set accountNumbers;
>> >
>> > rule "Check debtor account number is not null"
>> >     salience -1
>> > when
>> >     $c : CreditTransferTransactionInformation10 ( eval(
>> > dbtrAcct.?id.?othr.?id == null ) )
>> > then
>> >     invalidate($c, "PG003", "Account number is absent");
>> >     drools.halt();
>> > end
>> >
>> > Ta
>> > Meeraj
>> >
>> > _______________________________________________
>> > rules-users mailing list
>> > rules-users at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>> >
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100718/40491270/attachment.html 


More information about the rules-users mailing list