Package org.apache.velocity.context

# Class ChainedInternalContextAdapter

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

All Implemented Interfaces:
  `Context`, `InternalContextAdapter`, `InternalEventContext`, `InternalWrapperContext`

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

Fields
Modifier and Type
Field
Description
`protected InternalContextAdapter`
`wrappedContext`
the parent context

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
Description
`EventCartridge`
`attachEventCartridge(EventCartridge ec)`
`boolean`
`containsKey(String 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()`
`String`
`getCurrentMacroName()`
`Resource`
`getCurrentResource()`
`String`
`getCurrentTemplateName()`
`EventCartridge`
`getEventCartridge()`
`Context`
`getInternalUserContext()`
Return the inner / user context.
`String[]`
`getKeys()`
Get all the keys for the values in the context.
`List<Template>`
`getMacroLibraries()`
`String[]`
`getMacroNameStack()`
`String[]`
`getTemplateNameStack()`
`IntrospectionCacheData`
`icacheGet(Object key)`
`void`
`icachePut(Object key, IntrospectionCacheData o)`
`void`
`popCurrentMacroName()`
`void`
`popCurrentTemplateName()`
`void`
`pushCurrentMacroName(String s)`
`void`
`pushCurrentTemplateName(String s)`
`Object`
`put(String key, Object value)`
Put method also stores values in parent context
`Object`
`remove(String key)`
Removes the value associated with the specified key from the context.
`void`
`setCurrentResource(Resource r)`
`void`
`setMacroLibraries(List<Template> macroLibraries)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### wrappedContext

protected InternalContextAdapter wrappedContext
the parent context

## Constructor Details

### ChainedInternalContextAdapter

public ChainedInternalContextAdapter(InternalContextAdapter inner)
CTOR, wraps an ICA

Parameters:
  `inner` - context

## Method Details

### 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`
Specified by:
  `get` in interface `InternalWrapperContext`
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`
Specified by:
  `put` in interface `InternalWrapperContext`
Parameters:
  `key` - name of item to set
  `value` - object to set to key
Returns:
  old stored object

### containsKey

public boolean containsKey(String key)
Description copied from interface: `Context`
Indicates whether the specified key is in the context.

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

### getKeys

public String[] 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(String 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.String)`

### pushCurrentTemplateName

public void pushCurrentTemplateName(String s)

See Also:
  - `InternalHousekeepingContext.pushCurrentTemplateName(java.lang.String)`

### popCurrentTemplateName

public void popCurrentTemplateName()

See Also:
  - `InternalHousekeepingContext.popCurrentTemplateName()`

### getCurrentTemplateName

public String getCurrentTemplateName()

See Also:
  - `InternalHousekeepingContext.getCurrentTemplateName()`

### getTemplateNameStack

public String[] getTemplateNameStack()

See Also:
  - `InternalHousekeepingContext.getTemplateNameStack()`

### pushCurrentMacroName

public void pushCurrentMacroName(String s)

See Also:
  - `InternalHousekeepingContext.pushCurrentMacroName(java.lang.String)`

### popCurrentMacroName

public void popCurrentMacroName()

See Also:
  - `InternalHousekeepingContext.popCurrentMacroName()`

### getCurrentMacroName

public String getCurrentMacroName()

See Also:
  - `InternalHousekeepingContext.getCurrentMacroName()`

### getCurrentMacroCallDepth

public int getCurrentMacroCallDepth()

See Also:
  - `InternalHousekeepingContext.getCurrentMacroCallDepth()`

### getMacroNameStack

public String[] getMacroNameStack()

See Also:
  - `InternalHousekeepingContext.getMacroNameStack()`

### icacheGet

public IntrospectionCacheData icacheGet(Object key)

See Also:
  - `InternalHousekeepingContext.icacheGet(java.lang.Object)`

### icachePut

public void icachePut(Object key, IntrospectionCacheData o)

See Also:
  - `InternalHousekeepingContext.icachePut(java.lang.Object, org.apache.velocity.util.introspection.IntrospectionCacheData)`

### setMacroLibraries

public void setMacroLibraries(List<Template> macroLibraries)

See Also:
  - `InternalHousekeepingContext.setMacroLibraries(List)`

### getMacroLibraries

public List<Template> getMacroLibraries()

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)

See Also:
  - `InternalHousekeepingContext.setCurrentResource(org.apache.velocity.runtime.resource.Resource)`

### getCurrentResource

public Resource getCurrentResource()

See Also:
  - `InternalHousekeepingContext.getCurrentResource()`