Added the appendDefault method to the StatementBuilder

This commit is contained in:
mathias 2021-08-26 21:38:29 +02:00
parent 4a6f0c6901
commit c6ed5d9b8d
No known key found for this signature in database
GPG Key ID: 8950DF62139C852A

View File

@ -6,6 +6,7 @@ public class StatementBuilder {
/**
* Basic constructor of the {@link StatementBuilder} with a prefilled text
*
* @param text The text you want to add
*/
public StatementBuilder(String text) {
@ -21,6 +22,7 @@ public class StatementBuilder {
/**
* Adds a text to the query with spaces
*
* @param text The text you want to add
* @return this class
*/
@ -32,8 +34,23 @@ public class StatementBuilder {
return this;
}
/**
* Adds a text to the query without spaces
*
* @param text The text you want to add
* @return this class
*/
public StatementBuilder appendDefault(String text) {
if (text.isEmpty()) return this;
query.append(text);
return this;
}
/**
* Builds the query string
*
* @return the built string
*/
public String build() {