org.antlr.stringtemplate
Class PathGroupLoader

java.lang.Object
  extended by org.antlr.stringtemplate.PathGroupLoader
All Implemented Interfaces:
StringTemplateGroupLoader
Direct Known Subclasses:
CommonGroupLoader

public class PathGroupLoader
extends java.lang.Object
implements StringTemplateGroupLoader

A brain dead loader that looks only in the directory(ies) you specify in the ctor. You may specify the char encoding. NOTE: this does not work when you jar things up! Use CommonGroupLoader instead in that case


Field Summary
protected  java.util.List dirs
          List of ':' separated dirs to pull groups from
protected  StringTemplateErrorListener errors
           
 
Constructor Summary
PathGroupLoader(java.lang.String dirStr, StringTemplateErrorListener errors)
          Pass a single dir or multiple dirs separated by colons from which to load groups/interfaces.
PathGroupLoader(StringTemplateErrorListener errors)
           
 
Method Summary
 void error(java.lang.String msg)
           
 void error(java.lang.String msg, java.lang.Exception e)
           
 java.lang.String getFileCharEncoding()
           
protected  java.io.InputStreamReader getInputStreamReader(java.io.InputStream in)
           
 StringTemplateGroup loadGroup(java.lang.String groupName)
          Load the group called groupName from somewhere.
 StringTemplateGroup loadGroup(java.lang.String groupName, java.lang.Class templateLexer, StringTemplateGroup superGroup)
          Load a group with a specified superGroup.
 StringTemplateGroup loadGroup(java.lang.String groupName, StringTemplateGroup superGroup)
          Load a group with a specified superGroup.
 StringTemplateGroupInterface loadInterface(java.lang.String interfaceName)
          Load the interface called interfaceName from somewhere.
protected  java.io.BufferedReader locate(java.lang.String name)
          Look in each directory for the file called 'name'.
 void setFileCharEncoding(java.lang.String fileCharEncoding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dirs

protected java.util.List dirs
List of ':' separated dirs to pull groups from


errors

protected StringTemplateErrorListener errors
Constructor Detail

PathGroupLoader

public PathGroupLoader(StringTemplateErrorListener errors)

PathGroupLoader

public PathGroupLoader(java.lang.String dirStr,
                       StringTemplateErrorListener errors)
Pass a single dir or multiple dirs separated by colons from which to load groups/interfaces.

Method Detail

loadGroup

public StringTemplateGroup loadGroup(java.lang.String groupName,
                                     java.lang.Class templateLexer,
                                     StringTemplateGroup superGroup)
Load a group with a specified superGroup. Groups with region definitions must know their supergroup to find templates during parsing.

Specified by:
loadGroup in interface StringTemplateGroupLoader

loadGroup

public StringTemplateGroup loadGroup(java.lang.String groupName,
                                     StringTemplateGroup superGroup)
Description copied from interface: StringTemplateGroupLoader
Load a group with a specified superGroup. Groups with region definitions must know their supergroup to find templates during parsing.

Specified by:
loadGroup in interface StringTemplateGroupLoader

loadGroup

public StringTemplateGroup loadGroup(java.lang.String groupName)
Description copied from interface: StringTemplateGroupLoader
Load the group called groupName from somewhere. Return null if no group is found.

Specified by:
loadGroup in interface StringTemplateGroupLoader

loadInterface

public StringTemplateGroupInterface loadInterface(java.lang.String interfaceName)
Description copied from interface: StringTemplateGroupLoader
Load the interface called interfaceName from somewhere. Return null if no interface is found.

Specified by:
loadInterface in interface StringTemplateGroupLoader

locate

protected java.io.BufferedReader locate(java.lang.String name)
                                 throws java.io.IOException
Look in each directory for the file called 'name'.

Throws:
java.io.IOException

getInputStreamReader

protected java.io.InputStreamReader getInputStreamReader(java.io.InputStream in)

getFileCharEncoding

public java.lang.String getFileCharEncoding()

setFileCharEncoding

public void setFileCharEncoding(java.lang.String fileCharEncoding)

error

public void error(java.lang.String msg)

error

public void error(java.lang.String msg,
                  java.lang.Exception e)