package cn.timer.api.dto.yggl; import java.util.HashMap; import java.util.List; import java.util.Map; public class PunishFactory { private static Map<String,IYgjgDto> punishMap = new HashMap<String,IYgjgDto>(); private PunishFactory() {} private static final IYgjgDto EMPTY = new EmptyPunish(); //获取 public static IYgjgDto getPunish(String state) { IYgjgDto result = punishMap.get(state); return result == null ? EMPTY : result; } //将处罚对象注册到这里 public static void registerPunish(String state,IYgjgDto o){ punishMap.put(state, o); } private static class EmptyPunish implements IYgjgDto { public List<String> exePunish() { return null; } } }