Java Code Examples for org.apache.cassandra.thrift.SlicePredicate#addToColumn_names()

The following examples show how to use org.apache.cassandra.thrift.SlicePredicate#addToColumn_names() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CassandraTransaction.java    From Doradus with Apache License 2.0 5 votes vote down vote up
private static Mutation createDeleteColumnMutation(byte[] colName, long timestamp) {
    SlicePredicate slicePred = new SlicePredicate();
    slicePred.addToColumn_names(ByteBuffer.wrap(colName));
    
    Deletion deletion = new Deletion();
    deletion.setPredicate(slicePred);
    deletion.setTimestamp(timestamp);
    
    Mutation mutation = new Mutation();
    mutation.setDeletion(deletion);
    return mutation;
}
 
Example 2
Source File: CassandraDefs.java    From Doradus with Apache License 2.0 5 votes vote down vote up
/**
 * Create a SlicePredicate that selects the given column names.
 * 
 * @param colNames  A collection of column names as byte[]s.
 * @return          SlicePredicate that selects the given column names only.
 */
static SlicePredicate slicePredicateColNames(Collection<byte[]> colNames) {
    SlicePredicate slicePred = new SlicePredicate();
    for (byte[] colName : colNames) {
        slicePred.addToColumn_names(ByteBuffer.wrap(colName));
    }
    return slicePred;
}
 
Example 3
Source File: CassandraDefs.java    From Doradus with Apache License 2.0 2 votes vote down vote up
/**
 * Create a SlicePredicate that selects a single column.
 * 
 * @param colName   Column name as a byte[].
 * @return          SlicePredicate that select the given column name only.
 */
static SlicePredicate slicePredicateColName(byte[] colName) {
    SlicePredicate slicePred = new SlicePredicate();
    slicePred.addToColumn_names(ByteBuffer.wrap(colName));
    return slicePred;
}