KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > context > Context


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

18
19 /**
20  * Interface describing the application data context. This set of
21  * routines is used by the application to set and remove 'named' data
22  * object to pass them to the template engine to use when rendering
23  * a template.
24  *
25  * This is the same set of methods supported by the original Context
26  * class
27  *
28  * @see org.apache.velocity.context.AbstractContext
29  * @see org.apache.velocity.VelocityContext
30  *
31  * @author <a HREF="mailto:jvanzyl@apache.org">Jason van Zyl</a>
32  * @author <a HREF="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
33  * @version $Id: Context.java,v 1.5.4.1 2004/03/03 23:22:54 geirm Exp $
34  */

35 public interface Context
36 {
37     /**
38      * Adds a name/value pair to the context.
39      *
40      * @param key The name to key the provided value with.
41      * @param value The corresponding value.
42      */

43     Object JavaDoc put(String JavaDoc key, Object JavaDoc value);
44
45     /**
46      * Gets the value corresponding to the provided key from the context.
47      *
48      * @param key The name of the desired value.
49      * @return The value corresponding to the provided key.
50      */

51     Object JavaDoc get(String JavaDoc key);
52  
53     /**
54      * Indicates whether the specified key is in the context.
55      *
56      * @param key The key to look for.
57      * @return Whether the key is in the context.
58      */

59     boolean containsKey(Object JavaDoc key);
60
61     /**
62      * Get all the keys for the values in the context
63      */

64     Object JavaDoc[] getKeys();
65
66     /**
67      * Removes the value associated with the specified key from the context.
68      *
69      * @param key The name of the value to remove.
70      * @return The value that the key was mapped to, or <code>null</code>
71      * if unmapped.
72      */

73     Object JavaDoc remove(Object JavaDoc key);
74 }
75
Popular Tags