org.brains2b.typewriter
Class CommentTemplate

java.lang.Object
  extended byorg.brains2b.typewriter.CommentTemplate
All Implemented Interfaces:
Template

public class CommentTemplate
extends java.lang.Object
implements Template

Create a comment in a ClassTemplate

TODO this should also be used to create Javadoc and comments for methods

Version:
0.10 [11/14/2002]
Author:
dennis@brains2b.nl

Field Summary
protected  java.util.List m_content
           
 
Constructor Summary
CommentTemplate()
          Constructor
 
Method Summary
 void addImport(java.lang.String name)
          add an String as import to the top class of this element
 void addText(java.lang.String text)
          add a comment line to the content of this template.
 java.util.List getContent()
          get the content for this template The vector will either contain Strings or other ContentTemplates
 Template getParent()
          get the direct parent of this element.

This can be the class, method, try element or loop elements

 void setContent(java.util.List content)
          set the content for this Template The vector should contain either contain Strings or other ContentTemplates
 void setParent(Template t)
          set the direct parent of this element

The parent can be the class, method, try element or loop elements

 void write(java.io.PrintWriter writer, int indent)
          write the template information to the PrintWriter at the given indention.

Indention is multiplied by 4 to supply the spaces for the indention.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_content

protected java.util.List m_content
Constructor Detail

CommentTemplate

public CommentTemplate()
Constructor

Method Detail

addImport

public void addImport(java.lang.String name)
add an String as import to the top class of this element

Specified by:
addImport in interface Template
Parameters:
name - String, the fully qualified class name. Could be used to enter the complete package by adding *

getParent

public Template getParent()
get the direct parent of this element.

This can be the class, method, try element or loop elements

Specified by:
getParent in interface Template
Returns:
Template, the parent of this element

setParent

public void setParent(Template t)
set the direct parent of this element

The parent can be the class, method, try element or loop elements

Specified by:
setParent in interface Template
Parameters:
t - Template, the parent of this element

write

public void write(java.io.PrintWriter writer,
                  int indent)
write the template information to the PrintWriter at the given indention.

Indention is multiplied by 4 to supply the spaces for the indention.

Specified by:
write in interface Template
Parameters:
writer - PrintWriter, an initialized PrintWriter to write this element of the Class to
indent - int, the indention for this element.

Value is multiplied by four to give the number of spaces used for indention


addText

public void addText(java.lang.String text)
add a comment line to the content of this template.

The line-end will be added by this Template

Parameters:
text - String, a line to add to the content

getContent

public java.util.List getContent()
get the content for this template

The vector will either contain Strings or other ContentTemplates

Returns:
Vector, a list of objects contained in this template, will always return a Vector even if there is no content.

setContent

public void setContent(java.util.List content)
set the content for this Template

The vector should contain either contain Strings or other ContentTemplates

Parameters:
content - Vector, a list of objects contained in this template, if null is inserted the content of this ContentTemplate will be removed and getContent() will return an empty Vector, not null.