1 ${database.allClassCopyright}package ${glPackageBaseCommon};
\r
3 import java.util.Map;
\r
4 import java.util.HashMap;
\r
7 * The context of internal map.
\r
9 * @author ${database.ClassAuthor}
\r
11 public class ${glInternalMapContextName} {
\r
13 // ===================================================================================
\r
16 /** The thread-local for this. */
\r
17 private static final ThreadLocal<Map<String, Object>> threadLocal = new ThreadLocal<Map<String, Object>>();
\r
19 protected static void initialize() {
\r
20 if (threadLocal.get() != null) {
\r
23 threadLocal.set(new HashMap<String, Object>());
\r
27 * Get the value of the object by the key.
\r
28 * @param key The key of the object. (NotNull)
\r
29 * @return The value of the object. (Nullable)
\r
31 public static Object getObject(String key) {
\r
33 return threadLocal.get().get(key);
\r
37 * Set the value of the object.
\r
38 * @param key The key of the object. (NotNull)
\r
39 * @param value The value of the object. (Nullable)
\r
41 public static void setObject(String key, Object value) {
\r
43 threadLocal.get().put(key, value);
\r
47 * Is existing internal-map-context on thread?
\r
49 * @return Determination.
\r
51 public static boolean isExistInternalMapContextOnThread() {
\r
52 return (threadLocal.get() != null);
\r
56 * Clear internal-map-context on thread.
\r
58 public static void clearInternalMapContextOnThread() {
\r
59 threadLocal.set(null);
\r