com.objectwave.templateMerge
Class MergeTemplate

java.lang.Object
  |
  +--com.objectwave.templateMerge.MergeTemplate
All Implemented Interfaces:
java.io.Serializable

public class MergeTemplate
extends java.lang.Object
implements java.io.Serializable

How do we handle the generation of code for which there is no corresponding data? For example, A package definition, is not mandatory. For collection tokens, all is taken care of this for us (since the enumeration size will be zero). The main entry point for this class is generateForOn. If following the source that is a good place to start. A current design constraint is that a template can only have 1 root object. This doesn't allow the use of InformationTokens that expect different objects as their arguments.

Version:
2.1
Author:
Dave Hoag
See Also:
generateForOn(java.lang.Object, java.io.OutputStream), Serialized Form

Constructor Summary
MergeTemplate()
           
 
Method Summary
 void addTemplate(MergeTemplate template)
           
 void body(java.lang.Object ci, java.io.OutputStream stream, java.util.Enumeration en)
           
 java.lang.StringBuffer browseBody()
          Return a StringBuffer containing what this template should generate.
 java.lang.StringBuffer browseLayoutBuffer(boolean fullView)
          Templates can contain other templates.
 void generateForOn(java.lang.Object ci, java.io.OutputStream stream)
          SourceCodeGeneration entry point.
 java.lang.String getPostBody()
          Just a string that should be generated after any sub templates.
 java.lang.String getPostFormattedBody()
          Gets the PostFormattedBody attribute of the MergeTemplate object
 TagTable getPostTagTable()
          Gets the PostTagTable attribute of the MergeTemplate object
 InformationToken[] getPostTokens()
           
 java.lang.String getPreBody()
          Just a string that should be generated before any sub templates.
 java.lang.String getPreFormattedBody()
          Gets the PreFormattedBody attribute of the MergeTemplate object
 TagTable getPreTagTable()
          Gets the PreTagTable attribute of the MergeTemplate object
 InformationToken[] getPreTokens()
           
 java.lang.String getTemplateName()
           
 MergeTemplate[] getTemplates()
           
 java.util.Enumeration postWrite(java.lang.Object ci, java.io.OutputStream stream)
           
 java.util.Enumeration preWrite(java.lang.Object ci, java.io.OutputStream stream)
           
 void setPostBody(java.lang.String body)
           
 void setPostFormattedBody(java.lang.String body)
          Sets the PostFormattedBody attribute of the MergeTemplate object
 void setPostTagTable(TagTable tagTable)
          Sets the PostTagTable attribute of the MergeTemplate object
 void setPostTokens(InformationToken[] toks)
           
 void setPreBody(java.lang.String body)
           
 void setPreFormattedBody(java.lang.String body)
          Sets the PreFormattedBody attribute of the MergeTemplate object
 void setPreTagTable(TagTable tagTable)
          Sets the PreTagTable attribute of the MergeTemplate object
 void setPreTokens(InformationToken[] toks)
           
 void setTemplateName(java.lang.String nm)
           
 void setTemplates(MergeTemplate[] temps)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MergeTemplate

public MergeTemplate()
Method Detail

setPostBody

public void setPostBody(java.lang.String body)
Parameters:
body - The new PostBody value

setPostTokens

public void setPostTokens(InformationToken[] toks)
Parameters:
toks - The new PostTokens value

setPreBody

public void setPreBody(java.lang.String body)
Parameters:
body - The new PreBody value

setPreTokens

public void setPreTokens(InformationToken[] toks)
Parameters:
toks - The new PreTokens value

setTemplateName

public void setTemplateName(java.lang.String nm)
Parameters:
nm - The new TemplateName value

setTemplates

public void setTemplates(MergeTemplate[] temps)
Parameters:
temps - The new Templates value

setPostTagTable

public void setPostTagTable(TagTable tagTable)
Sets the PostTagTable attribute of the MergeTemplate object

Parameters:
tagTable - The new PostTagTable value

setPreTagTable

public void setPreTagTable(TagTable tagTable)
Sets the PreTagTable attribute of the MergeTemplate object

Parameters:
tagTable - The new PreTagTable value

setPreFormattedBody

public void setPreFormattedBody(java.lang.String body)
Sets the PreFormattedBody attribute of the MergeTemplate object

Parameters:
body - The new PreFormattedBody value

setPostFormattedBody

public void setPostFormattedBody(java.lang.String body)
Sets the PostFormattedBody attribute of the MergeTemplate object

Parameters:
body - The new PostFormattedBody value

getPostBody

public java.lang.String getPostBody()
Just a string that should be generated after any sub templates.

Returns:
The PostBody value

getPostTokens

public InformationToken[] getPostTokens()
Returns:
The PostTokens value

getPreBody

public java.lang.String getPreBody()
Just a string that should be generated before any sub templates.

Returns:
The PreBody value

getPreTokens

public InformationToken[] getPreTokens()
Returns:
The PreTokens value

getTemplateName

public java.lang.String getTemplateName()
Returns:
The TemplateName value

getTemplates

public MergeTemplate[] getTemplates()
Returns:
The Templates value

getPostTagTable

public TagTable getPostTagTable()
Gets the PostTagTable attribute of the MergeTemplate object

Returns:
The PostTagTable value

getPreTagTable

public TagTable getPreTagTable()
Gets the PreTagTable attribute of the MergeTemplate object

Returns:
The PreTagTable value

getPreFormattedBody

public java.lang.String getPreFormattedBody()
Gets the PreFormattedBody attribute of the MergeTemplate object

Returns:
The PreFormattedBody value

getPostFormattedBody

public java.lang.String getPostFormattedBody()
Gets the PostFormattedBody attribute of the MergeTemplate object

Returns:
The PostFormattedBody value

generateForOn

public void generateForOn(java.lang.Object ci,
                          java.io.OutputStream stream)
SourceCodeGeneration entry point.

Parameters:
ci - java.lang.Object Provided to information token to sever as the source of data.
stream - java.io.OutputStream The stream unto which the generated text will be placed.

addTemplate

public void addTemplate(MergeTemplate template)
Parameters:
template - The feature to be added to the Template attribute

body

public void body(java.lang.Object ci,
                 java.io.OutputStream stream,
                 java.util.Enumeration en)
Parameters:
ci -
stream -
en -

browseBody

public java.lang.StringBuffer browseBody()
Return a StringBuffer containing what this template should generate.

Returns:

browseLayoutBuffer

public java.lang.StringBuffer browseLayoutBuffer(boolean fullView)
Templates can contain other templates. The argument will specify if the sub templates should be expanded.

Parameters:
fullView - True if you want sub templates expanded.
Returns:

postWrite

public java.util.Enumeration postWrite(java.lang.Object ci,
                                       java.io.OutputStream stream)
Parameters:
ci -
stream -
Returns:

preWrite

public java.util.Enumeration preWrite(java.lang.Object ci,
                                      java.io.OutputStream stream)
Parameters:
ci -
stream -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns: