package cn.cecep.talroad.service.strategy;

import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Auther: cjh
 * @Date: 2023-03-25 15:38
 * @Class: StrategyFactory
 * @Deseription:
 * @Version V1.0
 */
@Component
public class StrategyFactory {

    @Autowired
    private Map<String, Strategy> strategyMap;

    /**
     * 通过名字获取策略实现类
     *
     * @param strategyName
     * @return
     */
    public Strategy getByName(String strategyName) {
        return strategyMap.get(strategyName);
    }
}
