package com.moode.sms.framework; import java.util.HashMap; import java.util.Map; public class CommonServiceContext { private static CommonServiceContext commonServiceContext; private Map objectMap; private CommonServiceContext() { objectMap = new HashMap(); } public static CommonServiceContext getInstance() { if (commonServiceContext == null) { commonServiceContext = new CommonServiceContext(); } return commonServiceContext; } public void putObject(Class clazz, T object) { objectMap.put(clazz, object); } public T getObject(Class clazz) { return (T) objectMap.get(clazz); } }