com.ashridgetech.jamda.code
Class JavaWriter

java.lang.Object
  |
  +--com.ashridgetech.jamda.code.CodeWriter
        |
        +--com.ashridgetech.jamda.code.JavaWriter
Direct Known Subclasses:
ClassWriter, MethodCoder

public class JavaWriter
extends CodeWriter

A CodeWriter specialised to write Java code. Provides common Java statement coding functions.

Version:
1.0
Author:
Paul Boocock
See Also:
ClassWriter

Field Summary
 
Fields inherited from class com.ashridgetech.jamda.code.CodeWriter
underlyingWriter
 
Constructor Summary
protected JavaWriter(java.io.Writer writer)
          Construct a JavaWriter attached to a Writer.
 
Method Summary
 JavaWriter beginComment()
          Start a plain comment.
 JavaWriter commentLine(java.lang.String line)
          Write a plain comment line.
 JavaWriter endComment()
          End a plain comment.
 JavaWriter endStmt()
          End a statement and the current line.
 JavaWriter stmt(java.lang.String text)
          Write a code statement on a line, indented to the current indent level, adding a statement terminator if it does not have one.
 JavaWriter writeModifiers(int modifiers)
          Write the keywords for a set of modifiers.
 
Methods inherited from class com.ashridgetech.jamda.code.CodeWriter
begin, commaDoubleList, commaList, copyNoIndent, copyWithIndent, end, end, endLine, flush, getWriter, in, line, newline, newline, out, quote, space, spaceWrite, spaceWrite, spaceWrite, startLine, startLine, write, write, write, writeSpace, writeSpace, writeSpace, writeSpaced, writeSpaced, writeSpaced
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaWriter

protected JavaWriter(java.io.Writer writer)
Construct a JavaWriter attached to a Writer.

Parameters:
writer - the Writer to which the code is written.
Method Detail

endStmt

public JavaWriter endStmt()
End a statement and the current line.


stmt

public JavaWriter stmt(java.lang.String text)
Write a code statement on a line, indented to the current indent level, adding a statement terminator if it does not have one.

Parameters:
text - the text of the statement - may be null to produce an empty statement
Returns:
this object

beginComment

public JavaWriter beginComment()
Start a plain comment.


endComment

public JavaWriter endComment()
End a plain comment.


commentLine

public JavaWriter commentLine(java.lang.String line)
Write a plain comment line.

Parameters:
line - the text of the comment line

writeModifiers

public JavaWriter writeModifiers(int modifiers)
Write the keywords for a set of modifiers. If any modifier keywords are written, a space is written after the last one.

Parameters:
modifiers - the OR'ed values of the Java reflection modifier constants, as in Modifier.


Copyright © 2003 Ashridge Technologies Ltd. All Rights Reserved.