2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.database
;
12 import org
.springframework
.util
.Assert
;
14 public class NamedContextHolder
{
16 private static final ThreadLocal
<String
> contextHolder
= new ThreadLocal
<String
>();
18 public static void setContextKey(Object contextKey
) {
19 Assert
.notNull(contextKey
, "contextKey cannot be null");
20 Assert
.isInstanceOf(String
.class, contextKey
, "contextKey is not a String instance");
21 contextHolder
.set((String
)contextKey
);
24 public static String
getContextKey() {
25 return (String
) contextHolder
.get();
28 public static void clearContextKey() {
29 contextHolder
.remove();