interface 设置默认值

public interface ExecutorServerBase {
    default RuleResult getUserList(RuleParam rule) {
        RuleResult result = new RuleResult();
        List<String> userIdList = setUserList(rule);
        if (CollectionUtils.isEmpty(userIdList)) {
            result.setHasException(true);
            return result;
        }
        result.setHasException(userIdList.size() > 1);
        result.setUserIdList(userIdList);
        return result;
    }

    List<String> setUserList(RuleParam rule);
}

 

posted @ 2020-09-16 17:32  八英里  阅读(4079)  评论(0编辑  收藏  举报