|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
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.ClassWriter
A JavaWriter
extended with methods for
writing class structural elements. These include
the class declaration and headers, field variables
and methods.
JavaWriter
Nested Class Summary | |
static class |
ClassWriter.MethodDetails
Collects the details of a method in the code. |
Field Summary |
Fields inherited from class com.ashridgetech.jamda.code.CodeWriter |
underlyingWriter |
Constructor Summary | |
ClassWriter(java.io.Writer writer)
Construct a ClassWriter attached to a Writer . |
Method Summary | |
ClassWriter |
beginDoc()
Start a Javadoc comment. |
ClassWriter |
beginMethod(ClassWriter.MethodDetails details)
Start a method in the code. |
ClassWriter |
classDecl(java.lang.String className,
int modifiers,
java.lang.String extendsName,
java.util.Collection implementsNames)
Write a class declaration. |
ClassWriter |
classDoc(java.lang.String classDoc)
Write the class Javadoc, if any is supplied XXX - needs to split up multi-line comments, or long lines |
ClassWriter |
docLine(java.lang.String line)
Write a Javadoc comment line. |
ClassWriter |
docOneLine(java.lang.String line)
Write a Javadoc comment on a single line. |
ClassWriter |
endDoc()
End a Javadoc comment. |
ClassWriter |
field(java.lang.String typeName,
java.lang.String name,
int modifiers)
Declare a field variable in the code, without a comment or initial value. |
ClassWriter |
field(java.lang.String typeName,
java.lang.String name,
int modifiers,
java.lang.String initValue,
java.lang.String comment)
Declare a field variable in the code. |
ClassWriter |
fileHeader(java.lang.String fileName,
java.lang.String generator)
Write a file header comment. |
ClassWriter |
imports(java.util.Collection importNames)
Write the import declarations. |
ClassWriter |
interfaceDecl(java.lang.String name,
int modifiers,
java.util.Collection extendsNames)
Write an interface declaration. |
ClassWriter |
packageDecl(java.lang.String packageName)
Write a package declaration, if there is one. |
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 |
public ClassWriter(java.io.Writer writer)
ClassWriter
attached to a Writer
.
writer
- the Writer
to which the code is written.Method Detail |
public ClassWriter beginDoc()
public ClassWriter endDoc()
public ClassWriter docLine(java.lang.String line)
JavaWriter.commentLine(java.lang.String)
.
line
- the text of the comment line
public ClassWriter docOneLine(java.lang.String line)
public ClassWriter field(java.lang.String typeName, java.lang.String name, int modifiers)
typeName
- the name of the type of the fieldname
- the name of the fieldmodifiers
- as in JavaWriter.writeModifiers(int)
.public ClassWriter field(java.lang.String typeName, java.lang.String name, int modifiers, java.lang.String initValue, java.lang.String comment)
typeName
- the name of the type of the fieldname
- the name of the fieldmodifiers
- the OR'ed values of the Java reflection modifier
constants, as in Modifier
.initValue
- the initial value expression, or null if there is no initialisercomment
- the Javadoc comment, or null if there is no comment
public ClassWriter beginMethod(ClassWriter.MethodDetails details)
details
- the details of the method
public ClassWriter fileHeader(java.lang.String fileName, java.lang.String generator)
fileName
- the name of the file being written togenerator
- the name of the generator using this ClassWriter
public ClassWriter packageDecl(java.lang.String packageName)
packageName
- the name of the package - if null,
nothing is written
public ClassWriter classDecl(java.lang.String className, int modifiers, java.lang.String extendsName, java.util.Collection implementsNames)
className
- the name of the classmodifiers
- the OR'ed values of the Java reflection modifier
constants, as in Modifier
.extendsName
- the names of the class extended.
May be null if no class is extended.implementsNames
- a collection of Strings with the names
of interfaces implemented. May be null or empty if no classes are extended.
Returns:
this instance
interfaceDecl
public ClassWriter interfaceDecl(java.lang.String name,
int modifiers,
java.util.Collection extendsNames)
- Write an interface declaration.
- Parameters:
name
- the name of the interfacemodifiers
- the OR'ed values of the Java reflection modifier
constants, as in Modifier
.extendsNames
- a collection of Strings with the names
of classes extended. May be null or empty if no classes are extended.
Returns:
this instance
classDoc
public ClassWriter classDoc(java.lang.String classDoc)
- Write the class Javadoc, if any is supplied
XXX - needs to split up multi-line comments, or long lines
- Parameters:
classDoc
- the documentation to write - may be null
- Returns:
- this instance
imports
public ClassWriter imports(java.util.Collection importNames)
- Write the import declarations.
- Parameters:
importNames
- a collection of Strings with the names
of imports. May be null or empty if no imports.
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
Copyright © 2003 Ashridge Technologies Ltd. All Rights Reserved.