01: package org.apache.velocity.context;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21:
22: /**
23: * Interface describing the application data context. This set of
24: * routines is used by the application to set and remove 'named' data
25: * object to pass them to the template engine to use when rendering
26: * a template.
27: *
28: * This is the same set of methods supported by the original Context
29: * class
30: *
31: * @see org.apache.velocity.context.AbstractContext
32: * @see org.apache.velocity.VelocityContext
33: *
34: * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
35: * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
36: * @version $Id: Context.java 463298 2006-10-12 16:10:32Z henning $
37: */
38: public interface Context {
39: /**
40: * Adds a name/value pair to the context.
41: *
42: * @param key The name to key the provided value with.
43: * @param value The corresponding value.
44: * @return The old object or null if there was no old object.
45: */
46: Object put(String key, Object value);
47:
48: /**
49: * Gets the value corresponding to the provided key from the context.
50: *
51: * @param key The name of the desired value.
52: * @return The value corresponding to the provided key.
53: */
54: Object get(String key);
55:
56: /**
57: * Indicates whether the specified key is in the context.
58: *
59: * @param key The key to look for.
60: * @return Whether the key is in the context.
61: */
62: boolean containsKey(Object key);
63:
64: /**
65: * Get all the keys for the values in the context.
66: * @return All the keys for the values in the context.
67: */
68: Object[] getKeys();
69:
70: /**
71: * Removes the value associated with the specified key from the context.
72: *
73: * @param key The name of the value to remove.
74: * @return The value that the key was mapped to, or <code>null</code>
75: * if unmapped.
76: */
77: Object remove(Object key);
78: }
|