Merge branch 'master' of https://gitee.com/dromara/liteFlow into issues/I8MXHX

This commit is contained in:
luoyi
2024-01-20 16:34:37 +08:00
7 changed files with 13 additions and 11 deletions

View File

@@ -16,7 +16,7 @@ import com.yomahub.liteflow.flow.element.condition.BooleanConditionTypeEnum;
public class AndOperator extends BaseOperator<AndOrCondition> {
@Override
public AndOrCondition build(Object[] objects) throws Exception {
OperatorHelper.checkObjectSizeGtTwo(objects);
OperatorHelper.checkObjectSizeGteTwo(objects);
AndOrCondition andOrCondition = new AndOrCondition();
andOrCondition.setBooleanConditionType(BooleanConditionTypeEnum.AND);

View File

@@ -19,7 +19,7 @@ public class MustOperator extends BaseOperator<WhenCondition> {
@Override
public WhenCondition build(Object[] objects) throws Exception {
OperatorHelper.checkObjectSizeGtTwo(objects);
OperatorHelper.checkObjectSizeGteTwo(objects);
String errorMsg = "The caller must be WhenCondition item";
WhenCondition whenCondition = OperatorHelper.convert(objects[0], WhenCondition.class, errorMsg);

View File

@@ -16,7 +16,7 @@ import com.yomahub.liteflow.flow.element.condition.BooleanConditionTypeEnum;
public class OrOperator extends BaseOperator<AndOrCondition> {
@Override
public AndOrCondition build(Object[] objects) throws Exception {
OperatorHelper.checkObjectSizeGtTwo(objects);
OperatorHelper.checkObjectSizeGteTwo(objects);
AndOrCondition andOrCondition = new AndOrCondition();
andOrCondition.setBooleanConditionType(BooleanConditionTypeEnum.OR);

View File

@@ -15,7 +15,7 @@ public class ToOperator extends BaseOperator<SwitchCondition> {
@Override
public SwitchCondition build(Object[] objects) throws Exception {
OperatorHelper.checkObjectSizeGtTwo(objects);
OperatorHelper.checkObjectSizeGteTwo(objects);
String errorMsg = "The caller must be SwitchCondition item";
SwitchCondition switchCondition = OperatorHelper.convert(objects[0], SwitchCondition.class, errorMsg);

View File

@@ -10,8 +10,6 @@ import com.yomahub.liteflow.exception.DataNotFoundException;
import com.yomahub.liteflow.flow.element.Condition;
import com.yomahub.liteflow.flow.element.Executable;
import com.yomahub.liteflow.flow.element.Node;
import com.yomahub.liteflow.flow.element.condition.AndOrCondition;
import com.yomahub.liteflow.flow.element.condition.NotCondition;
import java.util.Objects;
@@ -35,13 +33,13 @@ public class OperatorHelper {
}
/**
* 检查参数数量,大于 2
* 检查参数数量,大于等于 2
* @param objects objects
* @throws QLException QLException
*/
public static void checkObjectSizeGtTwo(Object[] objects) throws QLException {
public static void checkObjectSizeGteTwo(Object[] objects) throws QLException {
checkObjectSizeGtZero(objects);
if (objects.length <= 1) {
if (objects.length < 2) {
throw new QLException("parameter error");
}
}