public class TemplateInspector extends Object
TemplateInspector manages the reflective rendering of a template, given a
template path and a Map of argument values as Strings. This class could certainly
use some refactoring, and in fact, the public contract ought to allow reuse for multiple
templates.| Modifier and Type | Class and Description |
|---|---|
static class |
TemplateInspector.InvalidTemplateException |
static class |
TemplateInspector.UnknownArgumentsException |
| Constructor and Description |
|---|
TemplateInspector(String p_templateName)
Construct an
TemplateInspector for a template path using the default
TemplateManager as determined via the TemplateManagerSource. |
TemplateInspector(org.jamon.TemplateManager manager,
String templateName)
Construct an
TemplateInspector with a template manager, template path. |
| Modifier and Type | Method and Description |
|---|---|
Class<?> |
getArgumentType(String argName) |
List<String> |
getOptionalArgumentNames() |
List<String> |
getRequiredArgumentNames() |
void |
render(Writer writer,
Map<String,Object> argMap)
Render the template.
|
void |
render(Writer writer,
Map<String,Object> argMap,
boolean ignoreUnusedParams)
Render the template.
|
public TemplateInspector(String p_templateName) throws TemplateInspector.InvalidTemplateException
TemplateInspector for a template path using the default
TemplateManager as determined via the TemplateManagerSource.p_templateName - the path of the template to be renderedTemplateInspector.InvalidTemplateExceptionpublic TemplateInspector(org.jamon.TemplateManager manager,
String templateName)
throws TemplateInspector.InvalidTemplateException
TemplateInspector with a template manager, template path.p_manager - the TemplateManager to usep_templateName - the path of the template to be renderedTemplateInspector.InvalidTemplateExceptionpublic void render(Writer writer, Map<String,Object> argMap) throws TemplateInspector.InvalidTemplateException, TemplateInspector.UnknownArgumentsException
writer - the Writer to render toargMap - a Map<String,String> of argumentsTemplateInspector.InvalidTemplateExceptionTemplateInspector.UnknownArgumentsExceptionpublic void render(Writer writer, Map<String,Object> argMap, boolean ignoreUnusedParams) throws TemplateInspector.InvalidTemplateException, TemplateInspector.UnknownArgumentsException
writer - the Writer to render toargMap - a Map<String,String> of argumentsignoreUnusedParams - whether to throw an exception if "extra" arguments are suppliedTemplateInspector.InvalidTemplateExceptionTemplateInspector.UnknownArgumentsExceptionCopyright © 2003–2015 Jamon developers. All rights reserved.