|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.util.StatementBuilder
public class StatementBuilder
A utility class to build a statement. In addition to the methods supported by StringBuilder, it allows to add a text only in the second iteration. This simplified constructs such as:
StringBuilder buff = new StringBuilder(); for (int i = 0; i < args.length; i++) { if (i > 0) { buff.append(", "); } buff.append(args[i]); }to
StatementBuilder buff = new StatementBuilder(); for (String s : args) { buff.appendExceptFirst(", "); buff.append(a); }
Constructor Summary | |
---|---|
StatementBuilder()
Create a new builder. |
|
StatementBuilder(java.lang.String string)
Create a new builder. |
Method Summary | |
---|---|
StatementBuilder |
append(char c)
Append a character. |
StatementBuilder |
append(long x)
Append a number. |
StatementBuilder |
append(java.lang.String s)
Append a text. |
void |
appendExceptFirst(java.lang.String s)
Append a text, except when this method is called the first time. |
void |
appendOnlyFirst(java.lang.String s)
Append a text, but only if appendExceptFirst was never called. |
int |
length()
Get the length. |
StatementBuilder |
resetCount()
Reset the loop counter. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StatementBuilder()
public StatementBuilder(java.lang.String string)
string
- the initial stringMethod Detail |
---|
public StatementBuilder append(java.lang.String s)
s
- the text to append
public StatementBuilder append(char c)
c
- the character to append
public StatementBuilder append(long x)
x
- the number to append
public StatementBuilder resetCount()
public void appendOnlyFirst(java.lang.String s)
s
- the text to appendpublic void appendExceptFirst(java.lang.String s)
s
- the text to appendpublic java.lang.String toString()
toString
in class java.lang.Object
public int length()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |