KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > util > ReferenceFieldHandler


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.portal.util;
17
18 import java.util.Collections JavaDoc;
19 import java.util.Map JavaDoc;
20
21 /**
22  * Field handler superclass for external references.
23  *
24  * @author <a HREF="mailto:bluetkemeier@s-und-n.de">Bj&ouml;rn L&uuml;tkemeier</a>
25  *
26  * @version CVS $Id: ReferenceFieldHandler.java 326102 2005-10-18 13:29:15Z cziegeler $
27  */

28 public abstract class ReferenceFieldHandler extends AbstractFieldHandler {
29     /**
30      * Used to pass resolvable objects to the field handler.
31      */

32     private static ThreadLocal JavaDoc threadLocalMap = new ThreadLocal JavaDoc();
33
34     /**
35      * Gets the map used to pass resolvable objects to the field handler.
36      */

37     public static Map JavaDoc getObjectMap() {
38         Map JavaDoc map = (Map JavaDoc) threadLocalMap.get();
39         if (map == null) {
40             map = Collections.EMPTY_MAP;
41         }
42         return map;
43     }
44
45     /**
46      * Sets the map used to pass resolvable objects to the field handler.
47      */

48     public static void setObjectMap(Map JavaDoc objectMap) {
49         threadLocalMap.set(objectMap);
50     }
51
52     public static void clearObjectMap() {
53         threadLocalMap.set(null);
54     }
55 }
56
Popular Tags