package com.engine.recruit.factory;

import com.engine.core.impl.Service;
import com.engine.recruit.exception.CustomizeRunTimeException;
import com.engine.recruit.service.RecruitButtonService;
import weaver.general.BaseBean;

/**
 * <p>聚才林招聘</p>
 * 招聘按钮工厂类
 *
 * @author:dxfeng
 * @createTime: 2023/09/18
 * @version: 1.0
 */
public class RecruitButtonFactory {

    /**
     * 根据类的全路径获取类对象
     *
     * @param className 类全路径
     * @param <T>
     * @return
     */
    public static <T extends Service> Class<T> getClass(String className) {
        Class<?> clazz;
        try {
            clazz = Class.forName(className);
            if (!RecruitButtonService.class.isAssignableFrom(clazz)) {
                throw new IllegalArgumentException("该类未实现RecruitButtonService");
            }
            return (Class<T>) clazz;
        } catch (ClassNotFoundException e) {
            new BaseBean().writeLog(e);
            throw new CustomizeRunTimeException("操作按钮配置出错，未获取到按钮实现类[" + className + "]");
        }


    }
}
