org.stringtemplate.v4
Class STGroupFile

java.lang.Object
  extended by org.stringtemplate.v4.STGroup
      extended by org.stringtemplate.v4.STGroupFile

public class STGroupFile
extends STGroup

The internal representation of a single group file (which must end in ".stg"). If we fail to find a group file, look for it via the CLASSPATH as a resource. Templates are only looked up in this file or an import.


Field Summary
protected  boolean alreadyLoaded
           
 java.lang.String fileName
           
 java.net.URL url
           
 
Fields inherited from class org.stringtemplate.v4.STGroup
adaptors, DEFAULT_ERR_MGR, DEFAULT_KEY, defaultGroup, delimiterStartChar, delimiterStopChar, DICT_KEY, dictionaries, encoding, errMgr, imports, iterateAcrossValues, NOT_FOUND_ST, renderers, templates, trackCreationEvents, typeToAdaptorCache, typeToRendererCache, verbose
 
Constructor Summary
STGroupFile(java.lang.String fileName)
          Load a file relative to current dir or from root or via CLASSPATH.
STGroupFile(java.lang.String fileName, char delimiterStartChar, char delimiterStopChar)
           
STGroupFile(java.lang.String fullyQualifiedFileName, java.lang.String encoding)
           
STGroupFile(java.lang.String fullyQualifiedFileName, java.lang.String encoding, char delimiterStartChar, char delimiterStopChar)
           
STGroupFile(java.net.URL url, java.lang.String encoding, char delimiterStartChar, char delimiterStopChar)
           
 
Method Summary
 java.lang.String getFileName()
           
 java.lang.String getName()
           
 java.net.URL getRootDirURL()
          Return root dir if this is group dir; return dir containing group file if this is group file.
 boolean isDefined(java.lang.String name)
          Is this template defined in this group or from this group below? Names must be absolute, fully-qualified names like /a/b
 boolean isDictionary(java.lang.String name)
           
 void load()
          Force a load if it makes sense for the group
protected  CompiledST load(java.lang.String name)
          Load st from disk if dir or load whole group file if .stg file (then return just one template).
 java.lang.String show()
           
 void unload()
          "unload" all templates and dictionaries but leave renderers, adaptors, and import relationships.
 
Methods inherited from class org.stringtemplate.v4.STGroup
compile, createSingleton, createStringTemplate, createStringTemplateInternally, createStringTemplateInternally, defineDictionary, defineRegion, defineTemplate, defineTemplate, defineTemplate, defineTemplateAlias, defineTemplateOrRegion, getAttributeRenderer, getEmbeddedInstanceOf, getInstanceOf, getListener, getMangledRegionName, getModelAdaptor, getUnMangledTemplateName, getURL, importTemplates, importTemplates, invalidateModelAdaptorCache, loadAbsoluteTemplateFile, loadGroupFile, loadTemplateFile, lookupImportedTemplate, lookupTemplate, rawDefineTemplate, rawGetDictionary, rawGetTemplate, registerModelAdaptor, registerRenderer, setListener, toString, undefineTemplate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fileName

public java.lang.String fileName

url

public java.net.URL url

alreadyLoaded

protected boolean alreadyLoaded
Constructor Detail

STGroupFile

public STGroupFile(java.lang.String fileName)
Load a file relative to current dir or from root or via CLASSPATH.


STGroupFile

public STGroupFile(java.lang.String fileName,
                   char delimiterStartChar,
                   char delimiterStopChar)

STGroupFile

public STGroupFile(java.lang.String fullyQualifiedFileName,
                   java.lang.String encoding)

STGroupFile

public STGroupFile(java.lang.String fullyQualifiedFileName,
                   java.lang.String encoding,
                   char delimiterStartChar,
                   char delimiterStopChar)

STGroupFile

public STGroupFile(java.net.URL url,
                   java.lang.String encoding,
                   char delimiterStartChar,
                   char delimiterStopChar)
Method Detail

isDictionary

public boolean isDictionary(java.lang.String name)
Overrides:
isDictionary in class STGroup

isDefined

public boolean isDefined(java.lang.String name)
Description copied from class: STGroup
Is this template defined in this group or from this group below? Names must be absolute, fully-qualified names like /a/b

Overrides:
isDefined in class STGroup

unload

public void unload()
Description copied from class: STGroup
"unload" all templates and dictionaries but leave renderers, adaptors, and import relationships. This essentially forces next getInstanceOf to reload templates.

Overrides:
unload in class STGroup

load

protected CompiledST load(java.lang.String name)
Description copied from class: STGroup
Load st from disk if dir or load whole group file if .stg file (then return just one template). name is fully-qualified.

Overrides:
load in class STGroup

load

public void load()
Description copied from class: STGroup
Force a load if it makes sense for the group

Overrides:
load in class STGroup

show

public java.lang.String show()
Overrides:
show in class STGroup

getName

public java.lang.String getName()
Overrides:
getName in class STGroup

getFileName

public java.lang.String getFileName()
Overrides:
getFileName in class STGroup

getRootDirURL

public java.net.URL getRootDirURL()
Description copied from class: STGroup
Return root dir if this is group dir; return dir containing group file if this is group file. This is derived from original incoming dir or filename. If it was absolute, this should come back as full absolute path. If only a URL is available, return URL of one dir up.

Overrides:
getRootDirURL in class STGroup


Copyright © 2011. All Rights Reserved.