com.force.sdk.codegen.template
Class StringTemplateWrapper

java.lang.Object
  extended by org.antlr.stringtemplate.StringTemplate
      extended by com.force.sdk.codegen.template.StringTemplateWrapper
All Implemented Interfaces:
Template

public class StringTemplateWrapper
extends org.antlr.stringtemplate.StringTemplate
implements Template

A StringTemplate implementation that conforms to the Template interface.

Author:
Tim Kral

Nested Class Summary
 
Nested classes/interfaces inherited from class org.antlr.stringtemplate.StringTemplate
org.antlr.stringtemplate.StringTemplate.Aggregate, org.antlr.stringtemplate.StringTemplate.STAttributeList
 
Field Summary
 
Fields inherited from class org.antlr.stringtemplate.StringTemplate
ANONYMOUS_ST_NAME, argumentContext, argumentsAST, attributeRenderers, attributes, chunks, defaultGroup, enclosingInstance, formalArguments, group, groupFileLine, isRegion, name, nativeGroup, numberOfDefaultArgumentValues, passThroughAttributes, pattern, referencedAttributes, REGION_EMBEDDED, REGION_EXPLICIT, REGION_IMPLICIT, regionDefType, regions, templateID, VERSION
 
Constructor Summary
StringTemplateWrapper()
          Initializes a blank StringTemplateWrapper with no state.
StringTemplateWrapper(String template)
          Initializes an anonymous StringTemplateWrapper from the given String.
StringTemplateWrapper(org.antlr.stringtemplate.StringTemplate stringTemplate)
          Copies the state from the given StringTemplate parameter to this StringTemplateWrapper.
 
Method Summary
 void injectView(String viewName, Object viewState)
          Inject view state into a Template.
 void write(Writer writer)
          Writes a Template along with any injected view state to the given Writer.
 
Methods inherited from class org.antlr.stringtemplate.StringTemplate
addChunk, addRegionName, breakTemplateIntoChunks, checkForTrouble, checkNullAttributeAgainstFormalArguments, containsRegionName, defineEmptyFormalArgumentList, defineFormalArgument, defineFormalArgument, defineFormalArguments, dup, error, error, get, getArgumentContext, getArgumentsAST, getAttribute, getAttributeRenderer, getAttributes, getChunks, getDependencyGraph, getDOTForDependencyGraph, getEnclosingInstance, getEnclosingInstanceStackString, getEnclosingInstanceStackTrace, getErrorListener, getFormalArgument, getFormalArguments, getGroup, getGroupFileLine, getInstanceOf, getName, getNativeGroup, getOutermostEnclosingInstance, getOutermostName, getRegionDefType, getTemplate, getTemplateDeclaratorString, getTemplateHeaderString, getTemplateID, inLintMode, isRecursiveEnclosingInstance, isRegion, lookupFormalArgument, parseAction, parseAggregateAttributeSpec, printDebugString, putToMultiValuedMap, rawSetArgumentAttribute, rawSetAttribute, registerRenderer, removeAttribute, reset, resetTemplateCounter, setArgumentContext, setArgumentsAST, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeRenderers, setAttributes, setDefaultArgumentValues, setEnclosingInstance, setErrorListener, setFormalArguments, setGroup, setGroupFileLine, setIsRegion, setLintMode, setName, setNativeGroup, setPassThroughAttributes, setPredefinedAttributes, setRegionDefType, setTemplate, toDebugString, toString, toString, toStructureString, toStructureString, trackAttributeReference, warning, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.force.sdk.codegen.template.Template
reset
 

Constructor Detail

StringTemplateWrapper

public StringTemplateWrapper()
Initializes a blank StringTemplateWrapper with no state.


StringTemplateWrapper

public StringTemplateWrapper(String template)
Initializes an anonymous StringTemplateWrapper from the given String.

Parameters:
template - a String which represents a StringTemplate pattern

StringTemplateWrapper

public StringTemplateWrapper(org.antlr.stringtemplate.StringTemplate stringTemplate)
Copies the state from the given StringTemplate parameter to this StringTemplateWrapper.

Parameters:
stringTemplate - the StringTemplate whose state is to be used in this StringTemplateWrapper
Method Detail

injectView

public void injectView(String viewName,
                       Object viewState)
Description copied from interface: Template
Inject view state into a Template.

A Template should recognize view state by a name. Thereforce, this method will inject the given view state object for the given name.

Specified by:
injectView in interface Template
Parameters:
viewName - the name of the view state
viewState - the view state object

write

public void write(Writer writer)
           throws IOException
Description copied from interface: Template
Writes a Template along with any injected view state to the given Writer.

Specified by:
write in interface Template
Parameters:
writer - a Java Writer to which the Template and its view state should be written
Throws:
IOException - if there is an error writing to the Java Writer


Copyright © 2011. All Rights Reserved.