All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.vizaizai.boot.support.Utils Maven / Gradle / Ivy

package com.github.vizaizai.boot.support;

import com.github.vizaizai.exception.EasyHttpException;
import com.github.vizaizai.interceptor.HttpInterceptor;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author liaochongwei
 * @date 2020/8/4 15:12
 */
public class Utils {
    private Utils() {
    }

    /**
     * 创建拦截器
     * @param clazzList 拦截器类型
     * @return List
     */
   public static List createHttpInterceptors(Class[]  clazzList) {
        List list;
        if (clazzList== null || clazzList.length == 0) {
            return Collections.emptyList();
        }
        list = new ArrayList<>();
        for (Class clazz : clazzList) {
            try {
                list.add(clazz.newInstance());
            } catch (Exception e) {
                throw new EasyHttpException("instance HttpInterceptor failure");
            }
        }
        return list;

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy