Added the CqlGenerators for Keyspace.

This commit is contained in:
john-mcpeek
2013-12-14 13:16:31 -05:00
parent 14f5d209e8
commit b88b4afc69
4 changed files with 44 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
package org.springframework.cassandra.core.keyspace;
public class AlterKeyspaceSpecification extends KeyspaceSpecification<AlterKeyspaceSpecification> {
public class AlterKeyspaceSpecification extends KeyspaceOptionsSpecification<AlterKeyspaceSpecification> {
}

View File

@@ -2,4 +2,29 @@ package org.springframework.cassandra.core.keyspace;
public class CreateKeyspaceSpecification extends KeyspaceSpecification<CreateKeyspaceSpecification> {
private boolean ifNotExists = false;
/**
* Causes the inclusion of an <code>IF NOT EXISTS</code> clause.
*
* @return this
*/
public CreateKeyspaceSpecification ifNotExists() {
return ifNotExists(true);
}
/**
* Toggles the inclusion of an <code>IF NOT EXISTS</code> clause.
*
* @return this
*/
public CreateKeyspaceSpecification ifNotExists(boolean ifNotExists) {
this.ifNotExists = ifNotExists;
return this;
}
public boolean getIfNotExists() {
return ifNotExists;
}
}

View File

@@ -2,4 +2,19 @@ package org.springframework.cassandra.core.keyspace;
public class DropKeyspaceSpecification extends KeyspaceNameSpecification<DropKeyspaceSpecification> {
private boolean ifExists;
public DropKeyspaceSpecification ifExists() {
return ifExists(true);
}
public DropKeyspaceSpecification ifExists(boolean ifExists) {
this.ifExists = ifExists;
return this;
}
public boolean getIfExists() {
return ifExists;
}
}

View File

@@ -22,10 +22,12 @@ import org.springframework.cassandra.core.cql.CqlStringUtils;
* @author John McPeek
* @param <T> The subtype of the {@link KeyspaceOptionsSpecification}.
*/
public abstract class KeyspaceOptionsSpecification<T extends KeyspaceOptionsSpecification<T>> extends KeyspaceNameSpecification<T> {
public abstract class KeyspaceOptionsSpecification<T extends KeyspaceOptionsSpecification<T>> extends
KeyspaceNameSpecification<KeyspaceOptionsSpecification<T>> {
protected Map<String, Object> options = new LinkedHashMap<String, Object>();
@SuppressWarnings( "unchecked" )
public T name(String name) {
return (T) super.name(name);
}