package com.qianwen.mdc.collect.service.feedback; import com.google.common.collect.ImmutableMap; import java.util.Map; import com.qianwen.core.tool.utils.SpringUtil; import com.qianwen.mdc.collect.enums.FeedbackTypeEnum; public class WorkstationFeedbackHandlerFactory { static Map handlerStrategyMap = new ImmutableMap.Builder().put(FeedbackTypeEnum.TIME_RANGE_FEEDBACK.getType(), SpringUtil.getBean(NoImmediateFeedbackHandlerStrategy.class)).put(FeedbackTypeEnum.IMMEDIATE_FEEDBACK.getType(), SpringUtil.getBean(ImmediateFeedbackHandlerStrategy.class)).put(FeedbackTypeEnum.CANCEL_FEEDBACK.getType(), SpringUtil.getBean(CancelFeedbackHandlerStrategy.class)).build(); public static class SingletonHolder { public static WorkstationFeedbackHandlerFactory feedbackHandlerFactory = new WorkstationFeedbackHandlerFactory(); } public static WorkstationFeedbackHandlerFactory getInstance() { return SingletonHolder.feedbackHandlerFactory; } public WorkstationFeedbackHandlerStrategy getConcreteStrategy(Integer feedbackType) { return handlerStrategyMap.get(feedbackType); } }