org.apache.commons.jelly.tags.velocity
Class JellyContextAdapter

java.lang.Object
  extended byorg.apache.commons.jelly.tags.velocity.JellyContextAdapter
All Implemented Interfaces:
org.apache.velocity.context.Context

public class JellyContextAdapter
extends java.lang.Object
implements org.apache.velocity.context.Context

Adapts a JellyContext for use as a Velocity Context. This context can be used in either read-only or read-write mode. When used as a read-only adapter, items put or removeed from the Velocity context are not permitted to propogate to the JellyContext, which is the default behavior. The adapter can also be used in a read-write mode. This permits changes made by Velocity to propogate to the JellyContext.

Version:
$Id: JellyContextAdapter.java 155420 2005-02-26 13:06:03Z dirkv $
Author:
Pete Kazmier

Constructor Summary
JellyContextAdapter(org.apache.commons.jelly.JellyContext jellyContext)
          Constructor.
 
Method Summary
 boolean containsKey(java.lang.Object key)
           
 java.lang.Object get(java.lang.String key)
           
 java.lang.Object[] getKeys()
           
 boolean isReadOnly()
          Tests if the adapter is read-only.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
           
 java.lang.Object remove(java.lang.Object key)
           
 void setReadOnly(boolean readOnly)
          Sets the read-only flag for this adapter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JellyContextAdapter

public JellyContextAdapter(org.apache.commons.jelly.JellyContext jellyContext)
Constructor.

Parameters:
jellyContext - The JellyContext to adapt
Method Detail

setReadOnly

public void setReadOnly(boolean readOnly)
Sets the read-only flag for this adapter. If the read-only flag is set, changes to the Velocity Context will not be propogated to the JellyContext. Turning the read-only flag off enables changes to propogate.

Parameters:
readOnly - If this parameter is true, the adapter becomes read-only. Setting the parameter to false the adapter becomes read-write.

isReadOnly

public boolean isReadOnly()
Tests if the adapter is read-only.

Returns:
true if the adpater is read-only; otherwise returns false.

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface org.apache.velocity.context.Context

get

public java.lang.Object get(java.lang.String key)
Specified by:
get in interface org.apache.velocity.context.Context

getKeys

public java.lang.Object[] getKeys()
Specified by:
getKeys in interface org.apache.velocity.context.Context

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Specified by:
put in interface org.apache.velocity.context.Context

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface org.apache.velocity.context.Context


Copyright © 2002-2006 Apache Software Foundation. All Rights Reserved.