Class AbstractWriter
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.AbstractWriter
-
- Direct Known Subclasses:
ExpressionWriter,StreamTracer
public abstract class AbstractWriter extends java.lang.ObjectAn abstract class for writing an object model as a textual output.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringBuilderactualIndentationprivate java.lang.Stringindentationprivate java.io.PrintWriteroutprivate charwhitespace
-
Constructor Summary
Constructors Constructor Description AbstractWriter(java.io.Writer out)Creates a build language writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddecreaseIndentation()Decreases the current indentation step.voidflush()Flushes the writer.protected java.io.WritergetOut()Returns the underlying writer.protected voidincreaseIndentation()Increases the current indentation step.protected voidprint(char ch)Prints a character.protected voidprint(int value)Prints an integer.protected voidprint(java.lang.Object object)Prints an object.protected voidprint(java.lang.String string)Prints a string.protected voidprintIndentation()Prints the indentation.protected voidprintJavaEscaped(java.lang.String string)Prints a Java-escaped string.protected voidprintln()Prints a newline.protected voidprintln(char ch)Prints a character with trailing newline.protected voidprintln(int value)Prints an integer with trailing newline.protected voidprintln(java.lang.Object object)Prints an object with trailing newline.protected voidprintln(java.lang.String string)Prints a string with trailing newline.protected voidprintWhitespace()Prints a whitespace character.voidsetIndentation(java.lang.String indentation)Defines an indentation step.
-
-
-
Method Detail
-
getOut
protected java.io.Writer getOut()
Returns the underlying writer.- Returns:
- the underlying writer
-
print
protected void print(java.lang.String string)
Prints a string.- Parameters:
string- the string to be printed
-
printJavaEscaped
protected void printJavaEscaped(java.lang.String string)
Prints a Java-escaped string.- Parameters:
string- the string to be printed
-
println
protected void println(java.lang.String string)
Prints a string with trailing newline.- Parameters:
string- the string to be printed
-
print
protected void print(char ch)
Prints a character.- Parameters:
ch- the character to be printed
-
println
protected void println(char ch)
Prints a character with trailing newline.- Parameters:
ch- the character to be printed
-
print
protected void print(int value)
Prints an integer.- Parameters:
value- the integer
-
println
protected void println(int value)
Prints an integer with trailing newline.- Parameters:
value- the integer
-
print
protected void print(java.lang.Object object)
Prints an object.- Parameters:
object- the object to be printed
-
println
protected void println(java.lang.Object object)
Prints an object with trailing newline.- Parameters:
object- the object to be printed
-
println
protected void println()
Prints a newline.
-
printIndentation
protected final void printIndentation()
Prints the indentation.
-
printWhitespace
protected final void printWhitespace()
Prints a whitespace character.
-
flush
public final void flush() throws java.io.IOExceptionFlushes the writer. Should be used if there aren't any more elements to read.- Throws:
java.io.IOException- If an I/O error occurs
-
setIndentation
public void setIndentation(java.lang.String indentation)
Defines an indentation step.- Parameters:
indentation- the indentation step
-
increaseIndentation
protected void increaseIndentation()
Increases the current indentation step.
-
decreaseIndentation
protected void decreaseIndentation()
Decreases the current indentation step.
-
-