|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.formaria.template.TemplateEngine
public class TemplateEngine
An engine for processing templates containing paramaterized resources.
Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from formaria.
$Revision: 1.5 $
| Field Summary | |
|---|---|
protected java.util.HashMap |
contents
|
protected Project |
currentProject
|
protected DefaultAttributeEvaluator |
evaluator
|
protected java.util.HashMap |
includes
|
protected java.util.Hashtable<java.lang.String,TemplateProcessor> |
processors
|
protected java.io.File |
sourceDir
|
protected java.lang.String |
sourcePath
|
protected java.io.File |
targetDir
|
protected java.lang.String |
targetPath
|
| Constructor Summary | |
|---|---|
TemplateEngine(Project proj,
java.lang.String source,
java.lang.String target)
Creates a new instance of TemplateEngine |
|
| Method Summary | |
|---|---|
java.lang.Object |
evaluateAttribute(java.lang.String attribValue)
Evaluates an attribute value. |
java.lang.String |
getContent(java.lang.String key)
|
java.util.HashMap |
getContents(TemplateProcessor tp)
|
java.util.HashMap |
getIncludes(TemplateProcessor tp)
|
TemplateProcessor |
getProcessor(java.lang.String sourceName,
int processingType)
Get the processor for a particular type |
java.lang.String |
getTargetResourceName(java.lang.String sourcePattern,
java.lang.String sourceName,
java.lang.String targetPattern,
int processingType)
Get the name of the resource when processed |
boolean |
includes(java.lang.String elementName)
Include a given element |
int |
process(java.lang.String[] sourceResources)
Process the template resources. |
int |
process(java.lang.String[] sourceResources,
java.lang.String[] targetResources,
int[] processingTypes)
Process the template resources. |
void |
putContent(java.lang.String key,
java.lang.String value)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String sourcePath
protected java.lang.String targetPath
protected java.io.File sourceDir
protected java.io.File targetDir
protected java.util.Hashtable<java.lang.String,TemplateProcessor> processors
protected Project currentProject
protected DefaultAttributeEvaluator evaluator
protected java.util.HashMap includes
protected java.util.HashMap contents
| Constructor Detail |
|---|
public TemplateEngine(Project proj,
java.lang.String source,
java.lang.String target)
proj - the owner projectsource - the source folder for the templatestarget - the target folder for the template output| Method Detail |
|---|
public int process(java.lang.String[] sourceResources)
sourceResources - the resources to process, the file names may contain
wildcard characterstargetResources - the resources name following processing, the file
names may contain wildcard characters, but they should match the pattern of
the sourceResource argument. The number of array elements should also
match that of the sourceResource. A null value may be passed for an
element or for the argument, in which case the getTargetResourceName
should fixup the resource name.
public int process(java.lang.String[] sourceResources,
java.lang.String[] targetResources,
int[] processingTypes)
sourceResources - the resources to process, the file names may contain
wildcard characterstargetResources - the resources name following processing, the file
names may contain wildcard characters, but they should match the pattern of
the sourceResource argument. The number of array elements should also
match that of the sourceResource. A null value may be passed for an
element or for the argument, in which case the getTargetResourceName
should fixup the resource name.processingType - the type of processing
public TemplateProcessor getProcessor(java.lang.String sourceName,
int processingType)
sourceName - the resource nameprocessingType - the processing instruction
public java.lang.String getTargetResourceName(java.lang.String sourcePattern,
java.lang.String sourceName,
java.lang.String targetPattern,
int processingType)
sourcePattern - the pattern used to find the source file, the file name may contain
wildcard characterssourceName - the actual resource to processtargetPattern - the resource name/pattern following processing, the file
name may contain wildcard characters, but they should match the pattern of
the sourceResource argument.processingType - the type of processing
public boolean includes(java.lang.String elementName)
elementName - the name of the element
public java.lang.Object evaluateAttribute(java.lang.String attribValue)
attribValue - the raw attribute value
public java.lang.String getContent(java.lang.String key)
public void putContent(java.lang.String key,
java.lang.String value)
public java.util.HashMap getContents(TemplateProcessor tp)
public java.util.HashMap getIncludes(TemplateProcessor tp)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||