[rules-users] How to declare an array attribute within an object in a DRL file?

Wolfgang Laun wolfgang.laun at gmail.com
Wed Apr 27 03:06:43 EDT 2011


Array types are not supported for the fields of types declared in DRL.
A java.util.ArrayList (no generic parameters) should work.

-W

On 26 April 2011 23:59, fulton <fulton.gee at lmco.com> wrote:

> I am currently using Drools Server to accept JSON-formatted insertion
> messages from a PHP application.  Within the DRL file, I am currently
> declaring the insertion object (let's use Person, for example) using
> "Declare", e.g.,
>
> declare Person
>  name: String
>  address: AddressType
> end
>
> declare AddressType
> ...
> end
>
> My question is, how do you declare an array object (e.g., "Hobbies") that
> can be nested within Person.  I have scanned the Internet (once again!) for
> longer than I care to admit and have found no examples for this simple
> usage.  I have unsuccessfully tried multiple variations in defining an
> array, but have given up.  My current intention is to avoid using
> externally
> defined Java, if possible, and I would like to be able to define the
> insertion object within the DRL to enable quick changes in the incoming
> JSON
> format, if necessary (I know this might not be "best practice"!).  Could
> someone please provide me with a quick example.
>
> Thanks!  Fulton
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-declare-an-array-attribute-within-an-object-in-a-DRL-file-tp2867666p2867666.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> 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/20110427/c28a1680/attachment.html 


More information about the rules-users mailing list