STYLE #I8VSD6 调整 checkObjectSizeGteTwo 名称、注释、判断 避免误解
This commit is contained in:
parent
e33fd3b0f7
commit
e60a60e12f
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue