org.apache.velocity.context
Interface Context

All Known Subinterfaces:
InternalContextAdapter
All Known Implementing Classes:
AbstractContext

public interface Context

Interface describing the application data context. This set of routines is used by the application to set and remove 'named' data object to pass them to the template engine to use when rendering a template. This is the same set of methods supported by the original Context class

Version:
$Id: Context.java,v 1.4 2001/10/23 20:48:04 dlr Exp $
Author:
Jason van Zyl, Geir Magnusson Jr.
See Also:
AbstractContext, VelocityContext

Method Summary
 boolean containsKey(java.lang.Object key)
          Indicates whether the specified key is in the context.
 java.lang.Object get(java.lang.String key)
          Gets the value corresponding to the provided key from the context.
 java.lang.Object[] getKeys()
          Get all the keys for the values in the context
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Adds a name/value pair to the context.
 java.lang.Object remove(java.lang.Object key)
          Removes the value associated with the specified key from the context.
 

Method Detail

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Adds a name/value pair to the context.
Parameters:
key - The name to key the provided value with.
value - The corresponding value.

get

public java.lang.Object get(java.lang.String key)
Gets the value corresponding to the provided key from the context.
Parameters:
key - The name of the desired value.
Returns:
The value corresponding to the provided key.

containsKey

public boolean containsKey(java.lang.Object key)
Indicates whether the specified key is in the context.
Parameters:
key - The key to look for.
Returns:
Whether the key is in the context.

getKeys

public java.lang.Object[] getKeys()
Get all the keys for the values in the context

remove

public java.lang.Object remove(java.lang.Object key)
Removes the value associated with the specified key from the context.
Parameters:
key - The name of the value to remove.
Returns:
The value that the key was mapped to, or null if unmapped.


Copyright © 2003 Apache Software Foundation. All Rights Reserved.