org.webmacro.engine
Class MacroBuildContext

java.lang.Object
  extended byorg.webmacro.Context
      extended byorg.webmacro.engine.BuildContext
          extended byorg.webmacro.engine.MacroBuildContext
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map

public class MacroBuildContext
extends BuildContext

A chained build context, for use in expanding macros. When called upon to evaluate a reference which is one of the macros formals, it evaluates the actual argument and returns that, otherwise it chains back to the build context.


Nested Class Summary
 
Nested classes inherited from class org.webmacro.Context
Context.TemplateEvaluationContext
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
MacroBuildContext(MacroDefinition macro, java.lang.Object[] args, BuildContext bc)
           
 
Method Summary
 boolean containsKey(java.lang.Object name)
          Method from Map interface, operates on underlying Map
 MacroDefinition getMacro(java.lang.String name)
          Search for a MacroDefinition in the build context
 BuildContext getRootContext()
           
protected  java.lang.Object internalGet(java.lang.Object name)
          Get the named object/property from the Context.
 void putMacro(java.lang.String name, MacroDefinition macro)
          Add a MacroDefinition to the build context
 
Methods inherited from class org.webmacro.engine.BuildContext
addFilter, clearFilters, getFilterMacro, getMacros, getParser, getVariableType, mergeConstants, setVariableType
 
Methods inherited from class org.webmacro.Context
clear, clone, cloneContext, containsValue, entrySet, get, getBroker, getCurrentLocation, getEvaluationExceptionHandler, getLog, getLog, getMap, getPool, getProperty, getProperty, getTemplateEvaluationContext, internalGet, isEmpty, isTiming, keySet, loadTools, put, put, put, put, put, put, put, put, put, put, putAll, putFunction, putGlobalFunction, recycle, remove, set, setEvaluationExceptionHandler, setMap, setPool, setProperty, setProperty, size, startTiming, startTiming, startTiming, startTiming, startTiming, stopTiming, toString, values
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

MacroBuildContext

public MacroBuildContext(MacroDefinition macro,
                         java.lang.Object[] args,
                         BuildContext bc)
Method Detail

getRootContext

public BuildContext getRootContext()

putMacro

public void putMacro(java.lang.String name,
                     MacroDefinition macro)
Description copied from class: BuildContext
Add a MacroDefinition to the build context

Overrides:
putMacro in class BuildContext

getMacro

public MacroDefinition getMacro(java.lang.String name)
Description copied from class: BuildContext
Search for a MacroDefinition in the build context

Overrides:
getMacro in class BuildContext

containsKey

public boolean containsKey(java.lang.Object name)
Description copied from class: Context
Method from Map interface, operates on underlying Map

Specified by:
containsKey in interface java.util.Map
Overrides:
containsKey in class Context

internalGet

protected java.lang.Object internalGet(java.lang.Object name)
                                throws PropertyException
Description copied from class: Context
Get the named object/property from the Context. If the Object does not exist and there is a tool of the same name then the Object will be instantiated and managed by the tool. If there's no such variable, it throws.

Overrides:
internalGet in class Context
Throws:
PropertyException