commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Wood" <richard_w...@nobilitas.com>
Subject multiple parent child relationships using xmlrules
Date Tue, 28 Jun 2005 16:45:35 GMT
Hello

I'm defining my rules using XML and using the DigesterRuleParser.
How can I set multiple parent child relationships and vice versa if I create 
more than one child object inside one pattern

example

class BBB {

void setAAA(AAA a) {...}
}

<pattern value="x">
    <object-create-rule classname="AAA" />

    <object-create-rule classname="BBB"/>
    <set-top-rule methodname="setAAA"/>
    <set-next-rule methodname="addBBB"/>
    <object-create-rule classname="BBB"/>
    <set-top-rule methodname="setAAA"/>
    <set-next-rule methodname="addBBB"/>

</pattern>

The second batch of setter rules won't work as the stack looks as follows

BBB
BBB
AAA

The xml would have to bes restructured to look something like this.

<pattern value="x">
    <object-create-rule classname="AAA" />

    <object-create-rule classname="BBB"> <- push object on stack
        <set-top-rule methodname="setAAA"/>
        <set-next-rule methodname="addBBB"/>
    </object-create-rule> <- pop object on stack
    <object-create-rule classname="BBB">
        <set-top-rule methodname="setAAA"/>
        <set-next-rule methodname="addBBB"/>
    </object-create-rule>

</pattern>

Any easy way to do this?

The method Rule.end() is not very helpful here.

Cheers
    Richard


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message