[rules-users] Generics support in conditions?

Edson Tirelli tirelli at post.com
Fri Jul 6 14:38:23 EDT 2007


   Emily,

   Yes, this is not supported since generics information is not available at
runtime, and in this way, we can't constrain facts by generics information.

   []s
   Edson

2007/7/6, Emily Harsh <mail at wolfprint.com>:
>
> Hello,
>
> I'm using Drools 4.0M3.  Several of the objects in our object model take
> advantage of generics.  I was able to utilize generics in the consequences
> by setting the Java language level to 1.5 in the
> PackageBuilderConfiguration, however I would also like to optimize my rule
> activations by using the concrete types in the conditions.  I'm assuming
> this is not currently supported since I get the following error when I try
> to specify the concrete type in the condition:
> mismatched token: [@345,1242:1242='<',<78>,30:15]; expecting type
> LEFT_PAREN[30,45]
>
> My working rule uses the following syntax:
> rule "Test Generics"
>     when
>         Span () # 4.0: Can we use concrete type Span<Integer>?
>     then
>         System.out.println("RULE: Matched Span()");
> end
>
> I would like to be able to specify the concrete type like this:
> rule "Test Generics 2"
>     when
>         Span<Integer> ()
>     then
>         System.out.println("RULE: Matched Span<Integer>()");
> end
>
> Our object model uses the generic type "Span" heavily.  I am hoping that I
> will be able to reduce the number of rule activations by specifying the
> concrete type in the condition.
>
> Any chance this will be available in the 4.0 general release?
>
> Thanks!
> Emily
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070706/d7c7d930/attachment.html 


More information about the rules-users mailing list