Self Action

    When an action is executed, the self variable is itself, so it is called a self action.

Implement

    You need to inherit the xworker.lang.actions.SelfAction model.

Obtaining the owner of the original object

    As a Self action, the self variable is the action itself. If the action is called as an action, then the original behavior owner model can not be obtained directly through the self variable. In the Self action, the owner of the action should be obtained. The code is as follows.

List<Thing> things = actionContext.getThings();
Thing realSelf = null;
if(things.size() > 1){
   realSelf = things.get(things.size() - 2);
}

 

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