1 30 package com.genimen.djeneric.tools.scriptengine.core.nodes; 31 32 import com.genimen.djeneric.tools.scriptengine.core.DjScriptParserEngine; 33 import com.genimen.djeneric.tools.scriptengine.core.SimpleNode; 34 import com.genimen.djeneric.tools.scriptengine.core.util.DjScriptExecutionException; 35 import com.genimen.djeneric.tools.scriptengine.core.util.DjScriptExecutionTimeScope; 36 37 public class FailStatementNode extends SimpleNode 38 { 39 40 public FailStatementNode(int i) 41 { 42 super(i); 43 } 44 45 public FailStatementNode(DjScriptParserEngine p, int i) 46 { 47 super(p, i); 48 } 49 50 public String getName() 51 { 52 return "fail"; 53 } 54 55 public String toString() 56 { 57 return getName(); 58 } 59 60 public void execute(DjScriptExecutionTimeScope ctxt) throws DjScriptExecutionException 61 { 62 if (getChild(0) instanceof ValueExpression) 63 { 64 ValueExpression ve = (ValueExpression) getChild(0); 65 Object o = ve.getValue(ctxt); 66 if (o == null) o = "null"; 67 68 throw new DjScriptExecutionException(o.toString(), this, true); 69 } 70 } 71 } | Popular Tags |