ChainedInternalContextAdapter (Velocity 1.7 API)
Keywords: org.apache.velocity.context.ChainedInternalContextAdapter class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.velocity.context
Class ChainedInternalContextAdapter

    java.lang.Object
      org.apache.velocity.context.ChainedInternalContextAdapter

All Implemented Interfaces:
  Context, InternalContextAdapter, InternalEventContext, org.apache.velocity.context.InternalHousekeepingContext, InternalWrapperContext

Direct Known Subclasses:
  EvaluateContext, Foreach.NullHolderContext, ProxyVMContext

public abstract class ChainedInternalContextAdapter
extends Object
implements InternalContextAdapter

This is an abstract internal-use-only context implementation to be used as a subclass for other internal-use-only contexts that wrap other internal-use-only contexts. We use this context to make it easier to chain an existing context as part of a new context implementation. It just delegates everything to the inner/parent context. Subclasses then only need to override the methods relevant to them.

Since:
  1.6
Version:
  $Id: ChainedInternalContextAdapter.java 685724 2008-08-13 23:12:12Z nbubna $
Author:
  Nathan Bubna

Field Summary
`protected InternalContextAdapter` | `innerContext` the parent context

Constructor Summary
`ChainedInternalContextAdapter(InternalContextAdapter inner)` CTOR, wraps an ICA

Method Summary
`EventCartridge` | `attachEventCartridge(EventCartridge ec)`
`boolean` | `containsKey(Object key)` Indicates whether the specified key is in the context.
`Object` | `get(String key)` Retrieves from parent context.
`InternalContextAdapter` | `getBaseContext()` Returns the base full context impl.
`int` | `getCurrentMacroCallDepth()` get the current macro call depth
`String` | `getCurrentMacroName()` get the current macro name
`Resource` | `getCurrentResource()` temporary fix to enable #include() to figure out current encoding.
`String` | `getCurrentTemplateName()` get the current template name
`EventCartridge` | `getEventCartridge()`
`Context` | `getInternalUserContext()` Return the inner / user context.
`Object[]` | `getKeys()` Get all the keys for the values in the context.
`List` | `getMacroLibraries()` Get the macro library list for the current template.
`Object[]` | `getMacroNameStack()` Returns the macro name stack in form of an array.
`Object[]` | `getTemplateNameStack()` Returns the template name stack in form of an array.
`IntrospectionCacheData` | `icacheGet(Object key)` returns an IntrospectionCache Data (@see IntrospectionCacheData) object if exists for the key
`void` | `icachePut(Object key, IntrospectionCacheData o)` places an IntrospectionCache Data (@see IntrospectionCacheData) element in the cache for specified key
`Object` | `localPut(String key, Object value)` Allows callers to explicitly put objects in the local context.
`void` | `popCurrentMacroName()` remove the current macro name from stack
`void` | `popCurrentTemplateName()` remove the current template name from stack
`void` | `pushCurrentMacroName(String s)` set the current macro name on top of stack
`void` | `pushCurrentTemplateName(String s)` set the current template name on top of stack
`Object` | `put(String key, Object value)` Put method also stores values in parent context
`Object` | `remove(Object key)` Removes the value associated with the specified key from the context.
`void` | `setCurrentResource(Resource r)`
`void` | `setMacroLibraries(List macroLibraries)` Set the macro library list for the current template.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### innerContext

    protected InternalContextAdapter innerContext

  the parent context

Constructor Detail

### ChainedInternalContextAdapter

    public ChainedInternalContextAdapter(InternalContextAdapter inner)

  CTOR, wraps an ICA

Parameters:
  `inner` - context

Method Detail

### getInternalUserContext

    public Context getInternalUserContext()

  Return the inner / user context.

  Specified by:
    `getInternalUserContext` in interface `InternalWrapperContext`
  Returns:
    The inner / user context.

### getBaseContext

    public InternalContextAdapter getBaseContext()

  Description copied from interface: `InternalWrapperContext`
  Returns the base full context impl.

  Specified by:
    `getBaseContext` in interface `InternalWrapperContext`
  Returns:
    The base full context impl.
  See Also:
    `InternalWrapperContext.getBaseContext()`

### get

    public Object get(String key)

  Retrieves from parent context.

  Specified by:
    `get` in interface `Context`
  Parameters:
    `key` - name of item to get
  Returns:
    stored object or null

### put

    public Object put(String key,
                      Object value)

  Put method also stores values in parent context

  Specified by:
    `put` in interface `Context`
  Parameters:
    `key` - name of item to set
    `value` - object to set to key
  Returns:
    old stored object

### containsKey

    public boolean containsKey(Object key)

  Description copied from interface: `Context`
  Indicates whether the specified key is in the context.

  Specified by:
    `containsKey` in interface `Context`
  Parameters:
    `key` - The key to look for.
  Returns:
    Whether the key is in the context.
  See Also:
    `Context.containsKey(java.lang.Object)`

### getKeys

    public Object[] getKeys()

  Description copied from interface: `Context`
  Get all the keys for the values in the context.

  Specified by:
    `getKeys` in interface `Context`
  Returns:
    All the keys for the values in the context.
  See Also:
    `Context.getKeys()`

### remove

    public Object remove(Object key)

  Description copied from interface: `Context`
  Removes the value associated with the specified key from the context.

  Specified by:
    `remove` in interface `Context`
  Parameters:
    `key` - The name of the value to remove.
  Returns:
    The value that the key was mapped to, or `null` if unmapped.
  See Also:
    `Context.remove(java.lang.Object)`

### pushCurrentTemplateName

    public void pushCurrentTemplateName(String s)

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  set the current template name on top of stack

  Specified by:
    `pushCurrentTemplateName` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Parameters:
    `s` - current template name
  See Also:
    `InternalHousekeepingContext.pushCurrentTemplateName(java.lang.String)`

### popCurrentTemplateName

    public void popCurrentTemplateName()

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  remove the current template name from stack

  Specified by:
    `popCurrentTemplateName` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  See Also:
    `InternalHousekeepingContext.popCurrentTemplateName()`

### getCurrentTemplateName

    public String getCurrentTemplateName()

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  get the current template name

  Specified by:
    `getCurrentTemplateName` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Returns:
    String current template name
  See Also:
    `InternalHousekeepingContext.getCurrentTemplateName()`

### getTemplateNameStack

    public Object[] getTemplateNameStack()

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  Returns the template name stack in form of an array.

  Specified by:
    `getTemplateNameStack` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Returns:
    Object[] with the template name stack contents.
  See Also:
    `InternalHousekeepingContext.getTemplateNameStack()`

### pushCurrentMacroName

    public void pushCurrentMacroName(String s)

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  set the current macro name on top of stack

  Specified by:
    `pushCurrentMacroName` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Parameters:
    `s` - current macro name
  See Also:
    `InternalHousekeepingContext.pushCurrentMacroName(java.lang.String)`

### popCurrentMacroName

    public void popCurrentMacroName()

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  remove the current macro name from stack

  Specified by:
    `popCurrentMacroName` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  See Also:
    `InternalHousekeepingContext.popCurrentMacroName()`

### getCurrentMacroName

    public String getCurrentMacroName()

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  get the current macro name

  Specified by:
    `getCurrentMacroName` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Returns:
    String current macro name
  See Also:
    `InternalHousekeepingContext.getCurrentMacroName()`

### getCurrentMacroCallDepth

    public int getCurrentMacroCallDepth()

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  get the current macro call depth

  Specified by:
    `getCurrentMacroCallDepth` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Returns:
    int current macro call depth
  See Also:
    `InternalHousekeepingContext.getCurrentMacroCallDepth()`

### getMacroNameStack

    public Object[] getMacroNameStack()

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  Returns the macro name stack in form of an array.

  Specified by:
    `getMacroNameStack` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Returns:
    Object[] with the macro name stack contents.
  See Also:
    `InternalHousekeepingContext.getMacroNameStack()`

### icacheGet

    public IntrospectionCacheData icacheGet(Object key)

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  returns an IntrospectionCache Data (@see IntrospectionCacheData) object if exists for the key

  Specified by:
    `icacheGet` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Parameters:
    `key` - key to find in cache
  Returns:
    cache object
  See Also:
    `InternalHousekeepingContext.icacheGet(java.lang.Object)`

### localPut

    public Object localPut(String key,
                           Object value)

  Description copied from interface: `InternalWrapperContext`
  Allows callers to explicitly put objects in the local context. Objects added to the context through this method always end up in the top-level context of possible wrapped contexts.

  Specified by:
    `localPut` in interface `InternalWrapperContext`
  Parameters:
    `key` - name of item to set.
    `value` - object to set to key.
  Returns:
    old stored object
  See Also:
    `InternalWrapperContext.localPut(java.lang.String,java.lang.Object)`

### icachePut

    public void icachePut(Object key,
                          IntrospectionCacheData o)

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  places an IntrospectionCache Data (@see IntrospectionCacheData) element in the cache for specified key

  Specified by:
    `icachePut` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Parameters:
    `key` - key
    `o` - IntrospectionCacheData object to place in cache
  See Also:
    `InternalHousekeepingContext.icachePut(java.lang.Object, org.apache.velocity.util.introspection.IntrospectionCacheData)`

### setMacroLibraries

    public void setMacroLibraries(List macroLibraries)

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  Set the macro library list for the current template.

  Specified by:
    `setMacroLibraries` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Parameters:
    `macroLibraries` - list of macro libraries to set
  See Also:
    `InternalHousekeepingContext.setMacroLibraries(List)`

### getMacroLibraries

    public List getMacroLibraries()

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  Get the macro library list for the current template.

  Specified by:
    `getMacroLibraries` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Returns:
    List of macro library names
  See Also:
    `InternalHousekeepingContext.getMacroLibraries()`

### attachEventCartridge

    public EventCartridge attachEventCartridge(EventCartridge ec)

  Specified by:
    `attachEventCartridge` in interface `InternalEventContext`
  Parameters:
    `ec` -
  Returns:
    The old EventCartridge.
  See Also:
    `InternalEventContext.attachEventCartridge(org.apache.velocity.app.event.EventCartridge)`

### getEventCartridge

    public EventCartridge getEventCartridge()

  Specified by:
    `getEventCartridge` in interface `InternalEventContext`
  Returns:
    The current EventCartridge.
  See Also:
    `InternalEventContext.getEventCartridge()`

### setCurrentResource

    public void setCurrentResource(Resource r)

  Specified by:
    `setCurrentResource` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Parameters:
    `r` -
  See Also:
    `InternalHousekeepingContext.setCurrentResource(org.apache.velocity.runtime.resource.Resource)`

### getCurrentResource

    public Resource getCurrentResource()

  Description copied from interface: `org.apache.velocity.context.InternalHousekeepingContext`
  temporary fix to enable #include() to figure out current encoding.

  Specified by:
    `getCurrentResource` in interface `org.apache.velocity.context.InternalHousekeepingContext`
  Returns:
    The current resource.
  See Also:
    `InternalHousekeepingContext.getCurrentResource()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.