diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/operator/WhenOperator.java b/liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/operator/WhenOperator.java index 65f577b20..00e289b0b 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/operator/WhenOperator.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/operator/WhenOperator.java @@ -1,42 +1,30 @@ package com.yomahub.liteflow.builder.el.operator; -import com.ql.util.express.Operator; import com.ql.util.express.exception.QLException; -import com.yomahub.liteflow.exception.ELParseException; +import com.yomahub.liteflow.builder.el.operator.base.BaseOperator; +import com.yomahub.liteflow.builder.el.operator.base.OperatorHelper; import com.yomahub.liteflow.flow.element.Executable; import com.yomahub.liteflow.flow.element.condition.WhenCondition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * EL规则中的WHEN的操作符 * @author Bryan.Zhang * @since 2.8.0 */ -public class WhenOperator extends Operator { - - private final Logger LOG = LoggerFactory.getLogger(this.getClass()); +public class WhenOperator extends BaseOperator { @Override - public WhenCondition executeInner(Object[] objects) throws Exception { - try { - if (objects.length == 0) { - throw new QLException("parameter is empty"); - } + public Object buildCondition(Object[] objects) throws Exception { + OperatorHelper.checkObjectSizeGtZero(objects); - WhenCondition whenCondition = new WhenCondition(); - for (Object obj : objects) { - if (obj instanceof Executable) { - whenCondition.addExecutable((Executable) obj); - } else { - throw new QLException("parameter must be executable item"); - } + WhenCondition whenCondition = new WhenCondition(); + for (Object obj : objects) { + if (obj instanceof Executable) { + whenCondition.addExecutable((Executable) obj); + } else { + throw new QLException("parameter must be executable item"); } - return whenCondition; - }catch (QLException e){ - throw e; - }catch (Exception e){ - throw new ELParseException("errors occurred in EL parsing"); } + return whenCondition; } }