[rules-users] Is there a "extends" for the "declare" of a new type?
Wolfgang Laun
wolfgang.laun at gmail.com
Sun May 29 01:47:04 EDT 2011
I was following almost literally the example given in the "Drools
Introduction", Section 2.1.1.4., Type Declaration 'extends'.
It appears that Drools is very similar to
Eleusis<http://en.wikipedia.org/wiki/Eleusis_%28card_game%29>;-)
-W
2011/5/29 Mark Proctor <mproctor at codehaus.org>
>
> This is what's in the unit test "test_ExtLegacy.drl":
> declare BetterLegacy extends LegacyBean
> // novel field
> oneMoreField : String = "Hello"
>
> // inherited fields redeclared to set initial value
> doubleField : Double = 3.3 @position(1) // tag
inherited field, will be 1st field
> strField : String = "XX"
> intField : int = 245
> prop : boolean = true
> // objField is not redeclared
> end
>
> and this one "test_Extends.drl"
> declare Person
> age : int = 99 @position(2)
> name : String = "john doe" @key @position(1)
> end
>
> declare Student extends Person
> school : String @key @position(3)
> end
>
>
> declare LongTermStudent extends Student
> years : int @key @position(5)
> course : String @position(4)
> end
>
>
> On 28/05/2011 18:22, Wolfgang Laun wrote:
>
> It doesn't work:
>
> declare Customer extends Person
>
> is declined with
>
> Cannot extend supertype 'date.cust.Person' (not a declared type)
>
> -W
>
> 2011/5/28 Edson Tirelli <ed.tirelli at gmail.com>
>>
>> Wolfgang,
>> I think Davide's implementation supports extending existing java
classes... did you tried? What is not possible is to implement interfaces,
since you can't define methods in the declare statement.
>> Edson
>>
>> 2011/5/28 Wolfgang Laun <wolfgang.laun at gmail.com>
>>>
>>> There is, since 5.2.0, the option of extending a class declared in DRL:
>>>
>>> declare A
>>> i : int
>>> end
>>>
>>> declare B extends A
>>> ...
>>> end
>>>
>>> Any class origninating from Java code cannot be extended in DRL.
>>>
>>> -W
>>>
>>>
>>> On 28 May 2011 10:56, Tomas Olsson <tol at sics.se> wrote:
>>>>
>>>> Hi,
>>>> I have tried to look this up but cannot find any clear answer on the
web.
>>>> Does drools support extension of existing classes for new type
declarations?
>>>> That would be very nice if this would be possible.
>>>>
>>>> /Tomas
>>>> _______________________________________________
>>>> 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
>>>
>>
>>
>>
>> --
>> Edson Tirelli
>> JBoss Drools Core Development
>> JBoss by Red Hat @ www.jboss.com
>>
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> 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/20110529/a0dd0855/attachment.html
More information about the rules-users
mailing list