Class JSourceCode
java.lang.Object
org.codehaus.modello.plugin.java.javasource.JSourceCode
A class for holding in-memory Java source code.
- Version:
- $Revision$ $Date$
- Author:
- Keith Visco
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty JSourceCodeJSourceCode
(String sourceCode) Creates a JSourceCode and adds the given String to it's contents -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given statement to this JSourceCode.void
Deprecated.this method is not here any mode in castor codegen 1.3rc1void
addIndented
(String statement) Adds the given statement to this JSourceCode.void
Appends the given String to the last line in this JSourceCodevoid
clear()
Clears all the code statements from this JSourceCodevoid
copyInto
(JSourceCode jsc) Copies the contents of this JSourceCode into the given JSourceCodevoid
indent()
Increases the current indent level by 1boolean
isEmpty()
Returns true if this JSourceCode is empty (ie.void
print
(JSourceWriter jsw) Prints this JSourceCode to the given JSourceWritertoString()
Returns the String representation of this JSourceCodevoid
unindent()
Decreases the indent level by 1
-
Constructor Details
-
JSourceCode
public JSourceCode()Creates an empty JSourceCode -
JSourceCode
Creates a JSourceCode and adds the given String to it's contents- Parameters:
sourceCode
- the source to add
-
-
Method Details
-
add
Adds the given statement to this JSourceCode. The statement will be added on a new line.- Parameters:
statement
- the statement to add
-
add
Deprecated.this method is not here any mode in castor codegen 1.3rc1Adds the given statement to this JSourceCode. The statement will be added on a new line.- Parameters:
statement
- the statement to addindentSize
- the indentSize is the size of the indentation to use when printing this JSourceCode- See Also:
-
addIndented
Adds the given statement to this JSourceCode. The statement will be added on a new line and added with increased indent. This is a convenience method for the sequenceindent(); add(statement); unindent();
- Parameters:
statement
- the statement to add
-
append
Appends the given String to the last line in this JSourceCode- Parameters:
segment
- the String to append
-
clear
public void clear()Clears all the code statements from this JSourceCode -
copyInto
Copies the contents of this JSourceCode into the given JSourceCode- Parameters:
jsc
- the JSourceCode to copy this JSourceCode into
-
indent
public void indent()Increases the current indent level by 1 -
isEmpty
public boolean isEmpty()Returns true if this JSourceCode is empty (ie. no source).- Returns:
- true if this JSourceCode is empty.
-
print
Prints this JSourceCode to the given JSourceWriter- Parameters:
jsw
- the JSourceWriter to print to
-
unindent
public void unindent()Decreases the indent level by 1 -
toString
Returns the String representation of this JSourceCode
-