|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rythmengine.utils.TextBuilder
public class TextBuilder
This class defines a chained text/string builder
| Nested Class Summary | |
|---|---|
protected static class |
TextBuilder.StrBuf
A data structure used to store both character based content and it's binary byte array. |
| Field Summary | |
|---|---|
protected StringBuilder |
__buffer
The internal buffer |
protected TextBuilder |
__caller
The caller text builder. |
| Constructor Summary | |
|---|---|
TextBuilder()
Construct a root text builder |
|
TextBuilder(TextBuilder caller)
Construct a chained text builder with a caller() instance |
|
| Method Summary | |
|---|---|
protected void |
__append(boolean b)
Append a boolean to internal buffer |
protected void |
__append(byte b)
Append a byte to internal buffer |
protected void |
__append(char c)
Append a char to internal buffer |
protected void |
__append(double d)
Append a double to internal buffer |
protected void |
__append(float f)
Append a float to internal buffer |
protected void |
__append(int i)
Append an integer to internal buffer |
protected void |
__append(long l)
Append a long to internal buffer |
protected void |
__append(Object o)
Append a object to internal buffer or output (os or writer). |
protected void |
__append(TextBuilder.StrBuf wrapper)
Append a TextBuilder.StrBuf content into the buffer |
StringBuilder |
__getBuffer()
Alias of buffer() |
void |
__setBuffer(StringBuilder buffer)
Set the internal buffer to this instance or if the caller() exists, to the caller instance |
StringBuilder |
buffer()
Return the internal buffer of the text builder. |
TextBuilder |
build()
Sub class could implement this method to append the generated source code to the buffer |
protected ITemplate |
caller()
Return the caller in ITemplate type |
TextBuilder |
clone(TextBuilder caller)
return a clone of this TextBuilder instance |
StringBuilder |
getSelfOut()
Get the buffer out from this instance |
TextBuilder |
np(Object o)
Print an new line break followed by an object |
TextBuilder |
p(boolean b)
Print a boolean to internal buffer or output (os or writer) |
TextBuilder |
p(byte b)
Print a byte to internal buffer or output (os or writer) |
TextBuilder |
p(char c)
Print a char to internal buffer or output (os or writer) |
TextBuilder |
p(double d)
Print a double to internal buffer or output (os or writer) |
TextBuilder |
p(float f)
Print a float to internal buffer or output (os or writer) |
TextBuilder |
p(int i)
Print an integer to internal buffer or output (os or writer) |
TextBuilder |
p(long l)
Print a long to internal buffer or output (os or writer) |
TextBuilder |
p(Object o)
Print a Object to internal buffer or output (os or writer)
null object will not be printed |
TextBuilder |
p(TextBuilder.StrBuf wrapper)
Print a TextBuilder.StrBuf to internal buffer or output (os or writer)
null object will not be printed |
TextBuilder |
p2t(Object o)
Print an object followed by two tabs \t |
TextBuilder |
p2tn(Object o)
Print an object followed by 2 tabs \t and an line break |
TextBuilder |
p3t(Object o)
Print an object followed by 3 tabs \t |
TextBuilder |
p3tn(Object o)
Print an object followed by 3 tabs \t and an line break |
TextBuilder |
p4t(Object o)
Print an object followed by 4 tabs \t |
TextBuilder |
p4tn(Object o)
Print an object followed by 4 tabs \t and an line break |
TextBuilder |
pn()
Print an new line break |
TextBuilder |
pn(Object o)
Print an object followed by an new line break |
TextBuilder |
pt(Object o)
Print an object followed by a tab \t |
TextBuilder |
ptn(Object o)
Print an object followed by a tab \t and an new line break |
void |
setSelfOut(StringBuilder buffer)
Set the internal buffer to this instance |
String |
toString()
Return the internal buffer or caller's internal buffer if it is null |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected StringBuilder __buffer
protected TextBuilder __caller
ITemplate instance
| Constructor Detail |
|---|
public TextBuilder()
public TextBuilder(TextBuilder caller)
caller() instance
caller - | Method Detail |
|---|
public StringBuilder buffer()
caller() instance's buffer
StringBuilderprotected ITemplate caller()
ITemplate type
ITemplatepublic StringBuilder __getBuffer()
buffer()
StringBuilderpublic void __setBuffer(StringBuilder buffer)
caller() exists, to the caller instance
buffer - public void setSelfOut(StringBuilder buffer)
buffer - public StringBuilder getSelfOut()
StringBuilderprotected void __append(TextBuilder.StrBuf wrapper)
TextBuilder.StrBuf content into the buffer
wrapper - public TextBuilder p(TextBuilder.StrBuf wrapper)
TextBuilder.StrBuf to internal buffer or output (os or writer)
null object will not be printed
wrapper -
protected void __append(Object o)
o - public final TextBuilder p(Object o)
Object to internal buffer or output (os or writer)
null object will not be printed
o -
protected void __append(char c)
c - public final TextBuilder p(char c)
c -
protected void __append(byte b)
b - public final TextBuilder p(byte b)
b -
protected void __append(int i)
i - public final TextBuilder p(int i)
i -
protected void __append(long l)
l - public final TextBuilder p(long l)
l -
protected void __append(float f)
f - public final TextBuilder p(float f)
f -
protected void __append(double d)
d - public final TextBuilder p(double d)
d -
protected void __append(boolean b)
b - public final TextBuilder p(boolean b)
b -
public final TextBuilder pn(Object o)
o -
public final TextBuilder pn()
public final TextBuilder np(Object o)
o -
public TextBuilder pt(Object o)
\t
o -
public TextBuilder ptn(Object o)
\t and an new line break
o -
public TextBuilder p2t(Object o)
\t
o -
public TextBuilder p2tn(Object o)
\t and an line break
o -
public TextBuilder p3t(Object o)
\t
o -
public TextBuilder p3tn(Object o)
\t and an line break
o -
public TextBuilder p4t(Object o)
\t
o -
public TextBuilder p4tn(Object o)
\t and an line break
o -
public TextBuilder build()
public String toString()
toString in class Objectpublic TextBuilder clone(TextBuilder caller)
caller -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||