public class Template extends Object
SyntaxException if any of the additional constraints are not
met.| Modifier and Type | Class and Description |
|---|---|
static class |
Template.TemplateType
An enumeration of the possible template types.
|
| Modifier and Type | Field and Description |
|---|---|
String |
name
The (valid) name of this template.
|
File |
source
The source from which this template was constructed.
|
SourceFile |
sourceFile
Information about the source file from which this template was
constructed.
|
Template.TemplateType |
type
The type of this template.
|
static Pattern |
validTemplateNameChars
Pattern with all valid characters for namespaced name.
|
| Constructor and Description |
|---|
Template(File source,
SourceRange sourceRange,
Template.TemplateType type,
String name,
List<Statement> statements)
Constructs a new template from the given information.
|
Template(String name)
Constructs a new object template with the given name which contains no
statements.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkValidInclude(Template.TemplateType includeeType,
Template.TemplateType includedType)
Determine whether a particular include combination is legal.
|
void |
execute(boolean runStatic,
Context context)
Execute each of the statements in turn.
|
static boolean |
isValidTemplateName(String name)
Check to see if the given name is a valid template name.
|
void |
templateNameVerification(String expectedName)
Check that the internal template name matches the expected template name.
|
String |
toString()
Create a reasonable string representation of this template.
|
public static final Pattern validTemplateNameChars
public final SourceFile sourceFile
public final File source
public final String name
public final Template.TemplateType type
public Template(String name) throws SyntaxException
SyntaxExceptionpublic Template(File source, SourceRange sourceRange, Template.TemplateType type, String name, List<Statement> statements) throws SyntaxException
source - absolute File indicating the source pan language template;
used for error messages and logging; may be nullsourceRange - the source range for the template declarationtype - TemplateType for this templatename - String indicating the name of this templatestatements - List of statements in this template (may be null)SyntaxExceptionpublic static boolean isValidTemplateName(String name)
name - template name to check for validitypublic void execute(boolean runStatic,
Context context)
runStatic - flag which indicates whether to run the static statements or
notcontext - context for the evaluation of the templatepublic static boolean checkValidInclude(Template.TemplateType includeeType, Template.TemplateType includedType)
includeeType - type of the template that is including another oneincludedType - type of the included templatepublic void templateNameVerification(String expectedName) throws SyntaxException
expectedName - expected name of the compiled templateSyntaxExceptionCopyright © 2014 Quattor. All Rights Reserved.