|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ashridgetech.jamda.code.CodeWriter | +--com.ashridgetech.jamda.code.JavaWriter | +--com.ashridgetech.jamda.code.MethodCoder
Base class for classes which write the code for Java method bodies.
Each instance can only be used once.
Extends JavaWriter
to provide common Java statement coding functions.
Also provides some useful utility functions.
Uses a private buffer to which the code is written.
Subclasses must implement the codeBody()
method.
MethodCoderFactory
Field Summary |
Fields inherited from class com.ashridgetech.jamda.code.CodeWriter |
underlyingWriter |
Constructor Summary | |
protected |
MethodCoder(Operation op,
UmlClassGenerator gen)
Construct a MethodCoder attached to a StringWriter . |
Method Summary | |
abstract void |
codeBody()
Must be implemented by subclasses to write the method body statements. |
void |
generate(java.io.Writer writer)
Write the generated class code to the output Writer . |
UmlClassGenerator |
getClassGenerator()
Get the UmlClassGenerator for which this instance is
generating code. |
Operation |
getOperation()
Get the Operation for which this instance is
generating code. |
java.util.List |
getParameters()
Get the Parameter s of the Operation
for which this instance is generating code. |
Type |
getReturnType()
Get the return Type of the Operation
for which this instance is generating code. |
Methods inherited from class com.ashridgetech.jamda.code.JavaWriter |
beginComment, commentLine, endComment, endStmt, stmt, writeModifiers |
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 |
protected MethodCoder(Operation op, UmlClassGenerator gen)
MethodCoder
attached to a StringWriter
.
op
- the Operation
being codedgen
- the UmlClassGenerator
using this coder. May
be used to access methods of the generator. One need for this is to call
ClassGenerator.addImport(java.lang.String)
if the code uses a type
which is not already used by a method or field of the class.Method Detail |
public Operation getOperation()
Operation
for which this instance is
generating code.
public java.util.List getParameters()
Parameter
s of the Operation
for which this instance is generating code.
List
of Parameter
objectspublic Type getReturnType()
Type
of the Operation
for which this instance is generating code.
Type
public UmlClassGenerator getClassGenerator()
UmlClassGenerator
for which this instance is
generating code.
public abstract void codeBody()
JavaWriter
.
public void generate(java.io.Writer writer) throws java.io.IOException
Writer
.
Calls codeBody()
.
writer
- the destination for the generated code
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |