org.apache.avalon.composition.model.impl
Class DefaultContext

java.lang.Object
  extended byorg.apache.avalon.composition.model.impl.DefaultContext
All Implemented Interfaces:
Context

public final class DefaultContext
extends Object
implements Context

Default implementation of a context object. The implementation maintains a mapping between context keys and context entry models. Requests for a context entry value are resolved through redirecting the request to an assigned model.

Version:
$Revision: 1.9 $ $Date: 2004/03/17 10:39:10 $
Author:
Avalon Development Team

Constructor Summary
DefaultContext(Map map)
          Creation of a new default context.
 
Method Summary
 Object get(Object key)
          Return a context value relative to a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultContext

public DefaultContext(Map map)

Creation of a new default context.

Parameters:
map - a map of context entry handlers
Method Detail

get

public Object get(Object key)
           throws ContextException
Return a context value relative to a key. If the context entry is unknown a ContextException containing the key as as the exception message and a null cause will be thrown. If the contrext entry is recognized and a error occurs during value resolution a ContextException will be thrown containing the causal exception.

Specified by:
get in interface Context
Parameters:
key - the context entry key
Returns:
the context entry value
Throws:
ContextException - if the key is unknown or unresolvable


Copyright © The Apache Software Foundation. All Rights Reserved.