net.sourceforge.templat.parser.context
Class TemplateParserContext

java.lang.Object
  extended by net.sourceforge.templat.parser.context.TemplateParserContext

public class TemplateParserContext
extends Object

Represents a context of variables. Basically, a context is simply a mapping of variable names to values.

Author:
Chris Mosher

Constructor Summary
TemplateParserContext()
           
 
Method Summary
 void addVariable(String varName, Object varValue)
           
 Object getValue(String varName)
          Gets the value of a given variable in this context.
 boolean isDefined(String varName)
          Checks to see if the given variable is defined in this context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateParserContext

public TemplateParserContext()
Method Detail

addVariable

public void addVariable(String varName,
                        Object varValue)
Parameters:
varName -
varValue -

isDefined

public boolean isDefined(String varName)
Checks to see if the given variable is defined in this context.

Parameters:
varName - name of variable to check
Returns:
true if the given variable is defined

getValue

public Object getValue(String varName)
                throws TemplateParsingException
Gets the value of a given variable in this context.

Parameters:
varName - name of variable to get
Returns:
the value of the given variable
Throws:
TemplateParsingException - if varName is not defined in this context