Java tutorial
//package com.java2s; import java.util.Map; public class Main { private static final ThreadLocal SESSION_MAP = new ThreadLocal(); public static Object get(String attribute) { Map map = (Map) SESSION_MAP.get(); return map.get(attribute); } public static <T> T get(String attribute, Class<T> clazz) { return (T) get(attribute); } }