🛠️ Code cleanup & added many new features #1

Merged
gnmyt merged 121 commits from features/code-cleanup into master 2021-09-02 13:34:00 +00:00
Showing only changes of commit 0772017633 - Show all commits

View File

@ -0,0 +1,47 @@
package de.gnmyt.sqltoolkit.querybuilder;
public class StatementBuilder {
private StringBuilder query = new StringBuilder();
/**
* Basic constructor of the {@link StatementBuilder} with a prefilled text
* @param text The text you want to add
*/
public StatementBuilder(String text) {
append(text);
}
/**
* Basic constructor of the {@link StatementBuilder}
*/
public StatementBuilder() {
}
/**
* Adds a text to the query with spaces
* @param text The text you want to add
* @return this class
*/
public StatementBuilder append(String text) {
if (text.isEmpty()) return this;
if (!query.toString().isEmpty()) query.append(" ");
query.append(text);
return this;
}
/**
* Builds the query string
* @return the built string
*/
public String build() {
return query.toString();
}
@Override
public String toString() {
return build();
}
}