All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.englishtown.vertx.cassandra.keyspacebuilder.CreateKeyspace Maven / Gradle / Ivy

There is a newer version: 3.6.1
Show newest version
package com.englishtown.vertx.cassandra.keyspacebuilder;

/**
 * CREATE KEYSPACE CQL3 statement builder
 */
public class CreateKeyspace extends KeyspaceBuilderBase {

    private boolean ifNotExists;

    CreateKeyspace(String keyspace) {
        super(keyspace);
    }

    public CreateKeyspace ifNotExists() {
        ifNotExists = true;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public StringBuilder buildQueryString() {
        StringBuilder sb = new StringBuilder();

        sb.append("CREATE KEYSPACE ");
        if (ifNotExists) {
            sb.append("IF NOT EXISTS ");
        }
        sb.append(keyspace);
        buildReplicationStrategy(sb);
        sb.append(" }");
        return sb;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy