com.scalar.db.sql.statement.builder.DropNamespaceStatementBuilder Maven / Gradle / Ivy
package com.scalar.db.sql.statement.builder;
import com.scalar.db.sql.statement.DropNamespaceStatement;
public class DropNamespaceStatementBuilder {
private DropNamespaceStatementBuilder() {}
public static class Start extends Cascade {
Start(String namespaceName) {
super(namespaceName, false);
}
/**
* Specifies that the namespace should be dropped only if it exists.
*
* @return a builder object
*/
public Cascade ifExists() {
return new Cascade(namespaceName, true);
}
/**
* Specifies whether the namespace should be dropped only if it exists.
*
* @param ifExists whether the namespace should be dropped only if it exists
* @return a builder object
*/
public Cascade ifExists(boolean ifExists) {
return new Cascade(namespaceName, ifExists);
}
}
public static class Cascade extends Buildable {
private Cascade(String namespaceName, boolean ifExists) {
super(namespaceName, ifExists, false);
}
/**
* Specifies that all the tables in the namespace should be dropped if the namespace has tables.
*
* @return a builder object
*/
public Buildable cascade() {
return new Buildable(namespaceName, ifExists, true);
}
/**
* Specifies whether all the tables in the namespace should be dropped if the namespace has
* tables.
*
* @param cascade whether the tables in the namespace should be dropped
* @return a builder object
*/
public Buildable cascade(boolean cascade) {
return new Buildable(namespaceName, ifExists, cascade);
}
}
public static class Buildable {
protected final String namespaceName;
protected final boolean ifExists;
private final boolean cascade;
private Buildable(String namespaceName, boolean ifExists, boolean cascade) {
this.namespaceName = namespaceName;
this.ifExists = ifExists;
this.cascade = cascade;
}
/**
* Builds a DropNamespaceStatement object.
*
* @return a DropNamespaceStatement object
*/
public DropNamespaceStatement build() {
return DropNamespaceStatement.create(namespaceName, ifExists, cascade);
}
}
}