
com.scalar.db.sql.statement.builder.DropTableStatementBuilder Maven / Gradle / Ivy
package com.scalar.db.sql.statement.builder;
import com.scalar.db.sql.TableRef;
import com.scalar.db.sql.statement.DropTableStatement;
import javax.annotation.Nullable;
public class DropTableStatementBuilder {
private DropTableStatementBuilder() {}
public static class Start extends Buildable {
Start(@Nullable String namespaceName, String tableName) {
super(namespaceName, tableName, false);
}
/**
* Specifies that the table should be dropped only if it exists.
*
* @return a builder object
*/
public Buildable ifExists() {
return new Buildable(namespaceName, tableName, true);
}
/**
* Specifies whether the table should be dropped only if it exists.
*
* @param ifExists whether the table should be dropped only if it exists
* @return a builder object
*/
public Buildable ifExists(boolean ifExists) {
return new Buildable(namespaceName, tableName, ifExists);
}
}
public static class Buildable {
@Nullable protected final String namespaceName;
protected final String tableName;
private final boolean ifExists;
private Buildable(@Nullable String namespaceName, String tableName, boolean ifExists) {
this.namespaceName = namespaceName;
this.tableName = tableName;
this.ifExists = ifExists;
}
/**
* Builds a DropTableStatement object.
*
* @return a DropTableStatement object
*/
public DropTableStatement build() {
return DropTableStatement.create(TableRef.of(namespaceName, tableName), ifExists);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy