[rules-users] Explicit class cast in RHS

David Sinclair dsinclair at chariotsolutions.com
Thu Apr 9 09:28:28 EDT 2009


You could do one of two things. Insert the property into working memory, or
use the from statement in the rule.

$foo : Foo()
         TypeA(name == "PropertyA") from $foo.prop


2009/4/9 Alessandro Terrinoni <aleterrinoni at hotmail.com>

>
> This way my rule doesn't match
>
> At the moment i only provide Foo objects as facts. Do i have to provide
> also the field prop objects as facts for the rule to match?
>
> ------------------------------
> Date: Wed, 8 Apr 2009 12:26:01 -0400
> Subject: Re: [rules-users] Explicit class cast in RHS
> From: dsinclair at chariotsolutions.com
> To: rules-users at lists.jboss.org
>
> rule "abc"
>
> when
>      Foo($prop : prop)
>      TypeA (this == $prop, name == "PropertyA")
> then
> ...
>
> 2009/4/8 Alessandro Terrinoni <aleterrinoni at hotmail.com>
>
>  Hello
>
> in my working memory I insert an object like this
>
> public class Foo{
>
> private IntType prop;
>
> ...
>
> }
>
> where IntType is a class, but in practice *prop* is either of type TypeA
> or TypeB, both extending the IntType class.
>
>
> then i have a rule like this:
>
> rule "abc"
>
>     when
>
>         Foo(p : prop, p.name == "propertyA")
>
>     then
>         // call some method defined only in the TypeA class
>
> end
>
>
> how do i explicitly cast p into a TypeA object to call the method defined
> only in that class?
>
> thanks in advance,
> Alessandro Terrinoni
> ------------------------------
> Scegli fra più di 30 stazioni! Ascolta la radio su Messenger<http://clk.atdmt.com/GBL/go/140630364/direct/01/>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> ------------------------------
> Scegli fra più di 30 stazioni! Ascolta la radio su Messenger<http://clk.atdmt.com/GBL/go/140630364/direct/01/>
>
> _______________________________________________
> 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/20090409/3da76397/attachment.html 


More information about the rules-users mailing list