lodsve.redis.timer.RedisEventUtils Maven / Gradle / Ivy
/*
* Copyright (C) 2018 Sun.Hao
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package lodsve.redis.timer;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 根据类名解析处理类.
*
* @author sunhao([email protected])
* @version V1.0, 15/9/29 下午12:53
*/
public class RedisEventUtils {
private final static Map HANDLERS = new HashMap<>();
@Autowired
public RedisEventUtils(List handlers) {
for (RedisEventHandler bean : handlers) {
RedisEventType type = bean.getEventType();
RedisEventUtils.HANDLERS.put(type.getType(), bean);
}
}
public static RedisEventHandler getRedisEventHandler(String type) {
return HANDLERS.get(type);
}
}