|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.webmacro.servlet.TemplateTool.MacroTemplate
Encapsulates a template and a context, allowing a template to be used like a function or "macro".
Constructor Summary | |
TemplateTool.MacroTemplate(Context c,
java.lang.String src)
Construct a MacroTemplate with a StringTemplate |
|
TemplateTool.MacroTemplate(Context c,
Template t)
Constructor |
Method Summary | |
void |
copyCurrentContext()
Copies all variables from the current request context into the context of the macro. |
java.lang.Object |
eval()
Evaluates the macro's template against its context and returns the resulting string. |
java.lang.Object |
eval(java.util.Map map)
|
java.lang.Object |
eval(java.lang.Object[] args)
|
java.lang.Object |
eval(java.lang.Object[] args,
java.lang.Object[] names)
|
Context |
getArgs()
Exposes the context of the current MacroTemplate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TemplateTool.MacroTemplate(Context c, Template t)
c
- the current request contextt
- the template to be used as a macropublic TemplateTool.MacroTemplate(Context c, java.lang.String src)
c
- The context of the current requestsrc
- the string for the StringTemplateMethod Detail |
public Context getArgs()
#set $myMacro.Args.Name = $User.Name
public java.lang.Object eval() throws PropertyException
PropertyException
- runtime errors in evaluating the macro's templatepublic java.lang.Object eval(java.lang.Object[] args) throws PropertyException
PropertyException
public java.lang.Object eval(java.lang.Object[] args, java.lang.Object[] names) throws PropertyException
PropertyException
public java.lang.Object eval(java.util.Map map) throws PropertyException
PropertyException
public void copyCurrentContext()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |