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.Vector 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.Vector getContent()
          get the content for this template
 java.lang.String getObjectName(java.lang.String name)
          Deprecated. use TypeWriterHelper.getClassName(String)
 Template getParent()
          get the direct parent of this element.
 void setContent(java.util.Vector content)
          Set the content for this Template
 void setParent(Template t)
          set the direct parent of this element
 void write(java.io.PrintWriter writer, int indent)
          write the template information to the PrintWriter at the given 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.Vector m_content
Constructor Detail

CommentTemplate

public CommentTemplate()
Constructor

Method Detail

addImport

public void addImport(java.lang.String name)
Description copied from interface: Template
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 *

getObjectName

public java.lang.String getObjectName(java.lang.String name)
Deprecated. use TypeWriterHelper.getClassName(String)

get the Class name without the package

Specified by:
getObjectName in interface Template
Parameters:
name - String, a classname with or without a package
Returns:
String, the classname without the package

getParent

public Template getParent()
Description copied from interface: Template
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)
Description copied from interface: Template
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)
Description copied from interface: Template
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.Vector 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.Vector 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.