KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > tools > view > context > ToolboxContext


1 /*
2  * Copyright 2003 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
17 package org.apache.velocity.tools.view.context;
18
19 import java.util.Map JavaDoc;
20
21 import org.apache.velocity.VelocityContext;
22 import org.apache.velocity.context.Context;
23
24 /**
25  * <p>Read-only context used to carry a set of view tools.</p>
26  *
27  * <p>Writes get dropped.</p>
28  *
29  * @author <a HREF="mailto:sidler@apache.org">Gabriel Sidler</a>
30  * @author <a HREF="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
31  *
32  * @version $Id: ToolboxContext.java,v 1.3 2004/02/18 20:07:58 nbubna Exp $
33  */

34 public class ToolboxContext extends VelocityContext
35 {
36     /**
37      * The collection of view tools in this toolbox.
38      */

39     private Map JavaDoc toolbox;
40
41
42     /**
43      * Default constructor.
44      */

45     public ToolboxContext( Map JavaDoc tb )
46     {
47         toolbox = tb;
48     }
49
50
51     /**
52      * Get value for key.
53      */

54     public Object JavaDoc internalGet( String JavaDoc key )
55     {
56         return toolbox.get( key );
57     }
58
59
60     /**
61      * Does nothing. Returns <code>null</code> always.
62      */

63     public Object JavaDoc internalPut( String JavaDoc key, Object JavaDoc value )
64     {
65         return null;
66     }
67     
68 }
69
Popular Tags