1. Inherited

    In a dynamic model, a model can inherit any other model except itself, thereby inheriting the behavior of the inheritee.

2.extends property

    The model attribute extends is used to indicate which models the model inherits.

<?xml version='1.0' encoding='utf-8'?>

<thing name="Person" _xmeta_id_="379" descriptors="xworker.lang.MetaDescriptor3">
    <attribute name="name"/>
    <attribute name="age" _xmeta_id_="652"/>
    <attribute name="sex" _xmeta_id_="653" inputtype="select">
        <value name="male" _xmeta_id_="654" value="male"/>
        <value name="female" _xmeta_id_="655" value="female"/>
    <attribute name="birthDay" _xmeta_id_="656" inputtype="datePick"/>
    <attribute name="memo" _xmeta_id_="657" inputtype="html"/>
        <GroovyAction name="sayHello" descriptors="xworker.groovy.GroovyAction" code="println self.get(&quot;name&quot;) + &quot; say hello world!&quot; ;"/>
    <thing name="Child" extends="Person"/>

    As in the above model, <thing name="Child" extends="Person"/> indicates that its inheritance path is the Person model.

3. Multiple inheritance

    If a model inherits multiple models, then in the extends property, the paths of the models are separated by commas.

    eg: <Child extends="Person,Other"/>

    There is no limit to the number of model inheritances.

4. Inheritance of the descriptor

    When a model is used as the descriptor of other models, if this model also inherits other models, it also inherits the description of the corresponding structure.

    For example, the animal model has an age attribute, and the human model inherits the animal model, then the human also inherits the description of the age attribute. At this time, the human instance object Zhang San has the age attribute.

Copyright ©  2007-2019  版权所有  沪ICP备08000575号