public class CodeWriter extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static interface |
CodeWriter.ExternalWritingOperation |
static interface |
CodeWriter.JavaClassHandler |
Constructor and Description |
---|
CodeWriter(OutputStream stream) |
CodeWriter(OutputStream stream,
boolean suppressComment) |
CodeWriter(String path) |
CodeWriter(String rootDirectory,
String rootPackage,
CodeWriter.JavaClassHandler classBegin,
CodeWriter.JavaClassHandler classEnd) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
CodeWriter |
decreaseIndent() |
void |
flush() |
String |
getCurrentClassName() |
String |
getCurrentPackage() |
int |
getIndentLevel() |
CodeWriter |
increaseIndent() |
void |
onChangePackage(String newPackage)
Change current package.
|
void |
onClassBegin(String name) |
void |
onClassEnd() |
CodeWriter |
operate(CodeWriter.ExternalWritingOperation op) |
void |
setIndentLevel(int indentLevel) |
CodeWriter |
write(String s) |
CodeWriter |
writeIndent() |
CodeWriter |
writeIndentedLine(boolean condition,
String s) |
CodeWriter |
writeIndentedLine(String s) |
CodeWriter |
writeIndentedMultiLine(boolean condition,
String s) |
CodeWriter |
writeIndentedMultiLine(String s) |
CodeWriter |
writeLine() |
CodeWriter |
writeLine(boolean condition) |
CodeWriter |
writeLine(String s) |
public CodeWriter(OutputStream stream, boolean suppressComment)
public CodeWriter(OutputStream stream) throws IOException
IOException
public CodeWriter(String path)
public CodeWriter(String rootDirectory, String rootPackage, CodeWriter.JavaClassHandler classBegin, CodeWriter.JavaClassHandler classEnd)
public void onClassBegin(String name)
public void onClassEnd()
public String getCurrentClassName()
public void onChangePackage(String newPackage)
newPackage
- New package name WITHIN the root package.public String getCurrentPackage()
public void setIndentLevel(int indentLevel)
public int getIndentLevel()
public CodeWriter increaseIndent()
public CodeWriter decreaseIndent()
public CodeWriter operate(CodeWriter.ExternalWritingOperation op)
public CodeWriter writeIndent()
public CodeWriter write(String s)
public CodeWriter writeIndentedLine(String s)
public CodeWriter writeIndentedMultiLine(String s)
public CodeWriter writeIndentedLine(boolean condition, String s)
public CodeWriter writeIndentedMultiLine(boolean condition, String s)
public CodeWriter writeLine(String s)
public CodeWriter writeLine()
public CodeWriter writeLine(boolean condition)
public void flush() throws IOException
IOException
public void close() throws IOException
close
in interface AutoCloseable
IOException
Copyright © 2005–2024 Onix Solutions. All rights reserved.