net.sf.jmatchparser.template
Class MatchTemplate

java.lang.Object
  extended by net.sf.jmatchparser.template.MatchTemplate

public class MatchTemplate
extends Object

A template, usually loaded from a file, that is used by the Parser for matching.


Nested Class Summary
static interface MatchTemplate.MatchTemplateResolver
          Interface to resolve additional templates from $INCLUDE statements.
 
Constructor Summary
MatchTemplate(Class<?> clazz, String resourceName, String encoding, Formatter... formatters)
          Load a match template from a resource (a "file" on the class path).
MatchTemplate(File file, String encoding, Formatter... formatters)
          Load a match template from a file.
MatchTemplate(MatchTemplate.MatchTemplateResolver resolver, String templateName, BufferedReader br, Formatter... formatters)
          Load a match template from a custom reader.
MatchTemplate(String matchLanguage, MatchTemplate.MatchTemplateResolver resolver, String templateName, BufferedReader br, Formatter... formatters)
          Load a match template from a custom reader using a custom match language.
MatchTemplate(String filename, String encoding, Formatter... formatters)
          Load a match template from a file.
 
Method Summary
 void enableCoveredStatementsTracing()
          Enable tracing of covered statements.
 List<String> getIncludedTemplateFileNames()
          Get a list of template file names that are used by this template.
 List<String> getUncoveredStatements()
          Get a list of uncovered statements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatchTemplate

public MatchTemplate(String filename,
                     String encoding,
                     Formatter... formatters)
              throws IOException
Load a match template from a file.

Parameters:
filename - Name of the file
encoding - File encoding
formatters - Additional formatters to use (optional)
Throws:
IOException

MatchTemplate

public MatchTemplate(File file,
                     String encoding,
                     Formatter... formatters)
              throws IOException
Load a match template from a file.

Parameters:
file - The file
encoding - File encoding
formatters - Additional formatters to use (optional)
Throws:
IOException

MatchTemplate

public MatchTemplate(Class<?> clazz,
                     String resourceName,
                     String encoding,
                     Formatter... formatters)
              throws IOException
Load a match template from a resource (a "file" on the class path).

Parameters:
clazz - Class to use as a base for finding the resource
resourceName - Name of the resource
encoding - File encoding
formatters - Additional formatters to use (optional)
Throws:
IOException

MatchTemplate

public MatchTemplate(MatchTemplate.MatchTemplateResolver resolver,
                     String templateName,
                     BufferedReader br,
                     Formatter... formatters)
              throws IOException
Load a match template from a custom reader.

Parameters:
resolver - Match template resolver for resolving additional template names ($INCLUDE), optional
templateName - Name of the template
br - Reader to read the template from
formatters - Additional formatters to use (optional)
Throws:
IOException

MatchTemplate

public MatchTemplate(String matchLanguage,
                     MatchTemplate.MatchTemplateResolver resolver,
                     String templateName,
                     BufferedReader br,
                     Formatter... formatters)
              throws IOException
Load a match template from a custom reader using a custom match language.

Parameters:
matchLanguage - The match language (currently only "plain" is supported)
resolver - Match template resolver for resolving additional template names ($INCLUDE), optional
templateName - Name of the template
br - Reader to read the template from
formatters - Additional formatters to use (optional)
Throws:
IOException
Method Detail

enableCoveredStatementsTracing

public void enableCoveredStatementsTracing()
Enable tracing of covered statements. This can be used to find statements in your match templates that are no longer needed.

See Also:
getUncoveredStatements()

getUncoveredStatements

public List<String> getUncoveredStatements()
Get a list of uncovered statements. This only works if enableCoveredStatementsTracing() has been called before parsing.


getIncludedTemplateFileNames

public List<String> getIncludedTemplateFileNames()
Get a list of template file names that are used by this template. This includes the script itself and (recursively) all scripts that have been included by it, in the order they were included.



Copyright © 2011. All Rights Reserved.