|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.exolab.javasource.JSourceCode
public final class JSourceCode
A class for holding in-memory Java source code.
| Field Summary | |
|---|---|
static int |
DEFAULT_INDENT_SIZE
Default indentation size. |
| Constructor Summary | |
|---|---|
JSourceCode()
Creates an empty JSourceCode. |
|
JSourceCode(java.lang.String sourceCode)
Creates a JSourceCode and adds the given String to its contents. |
|
| Method Summary | |
|---|---|
void |
add(java.lang.String statement)
Adds the given statement to this JSourceCode. |
void |
add(java.lang.String pattern,
java.lang.Object argument)
Adds statement generated by replacing parameters of given pattern with given argument to this JSourceCode. |
void |
add(java.lang.String pattern,
java.lang.Object[] arguments)
Adds statements generated by replacing parameters of given pattern with given arguments to this JSourceCode. |
void |
add(java.lang.String pattern,
java.lang.Object argument1,
java.lang.Object argument2)
Adds statement generated by replacing parameters of given pattern with given arguments to this JSourceCode. |
void |
addIndented(java.lang.String statement)
Adds the given statement to this JSourceCode. |
void |
append(java.lang.String segment)
Appends the given String to the last line in this JSourceCode. |
void |
clear()
Clears all the code statements from this JSourceCode. |
void |
copyInto(JSourceCode jsc)
Copies the contents of this JSourceCode into the given JSourceCode. |
java.util.Vector<JCodeStatement> |
getSource()
Returns a vector of source lines. |
void |
indent()
Increases the current indent level by 1. |
boolean |
isEmpty()
Returns true if this JSourceCode is empty (ie. |
void |
print(JSourceWriter jsw)
Prints this JSourceCode to the given JSourceWriter. |
int |
size()
Returns the number of source code lines (aka JCodeStatements) set so far. |
java.lang.String |
toString()
|
void |
unindent()
Decreases the indent level by 1. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_INDENT_SIZE
| Constructor Detail |
|---|
public JSourceCode()
public JSourceCode(java.lang.String sourceCode)
sourceCode - the source to add| Method Detail |
|---|
public void add(java.lang.String pattern,
java.lang.Object argument)
pattern - Pattern for the statement.argument - Argument to replace first parameter in pattern.
public void add(java.lang.String pattern,
java.lang.Object argument1,
java.lang.Object argument2)
pattern - Pattern for the statement.argument1 - Argument to replace first parameter in pattern.argument2 - Argument to replace second parameter in pattern.
public void add(java.lang.String pattern,
java.lang.Object[] arguments)
pattern - Pattern for the statement.arguments - Arguments to replace parameters in pattern.public void add(java.lang.String statement)
statement - The statement to add.public void addIndented(java.lang.String statement)
indent();
add(statement);
unindent();
statement - The statement to add.public void append(java.lang.String segment)
segment - The String to append.public void clear()
public void copyInto(JSourceCode jsc)
jsc - The JSourceCode to copy this JSourceCode into.public void indent()
public boolean isEmpty()
public void print(JSourceWriter jsw)
jsw - The JSourceWriter to print to.public void unindent()
public int size()
public java.util.Vector<JCodeStatement> getSource()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||