me.prettyprint.cassandra.service.template
Class SuperCfUpdater<K,SN,N>

java.lang.Object
  extended by me.prettyprint.cassandra.service.template.AbstractTemplateUpdater<K,N>
      extended by me.prettyprint.cassandra.service.template.SuperCfUpdater<K,SN,N>
Type Parameters:
K - the key's data type
SN - the standard or super column's data type
N - the child column name type in a super column
V - the object instance to persist

public class SuperCfUpdater<K,SN,N>
extends AbstractTemplateUpdater<K,N>

This provides an interface of updating a specified row, most likely with the contents of an object. This would likely by implemented as an anonymous inner class with access to a final object in scope. It would update the given row with the object's data. This is currently implemented as an abstract base class instead of an interface. This could change in the future. Being an abstract base class allows CassandraTemplate to initialize this instance through package scope field access. This means that implementation of update() simply makes consecutive calls to various set****() methods which already have the contextual information they need to update the correct row. The downside of this approach is that the updater is essentially stateful and cannot be used concurrently. The alternative is to pass an object in to update() as a parameter with the setter methods, leaving the updater to be stateless.

Since:
Mar 10, 2011
Author:
david

Field Summary
protected  SuperCfTemplate<K,SN,N> template
           
 
Fields inherited from class me.prettyprint.cassandra.service.template.AbstractTemplateUpdater
columnFactory, keyPos, keys, mutator
 
Constructor Summary
SuperCfUpdater(SuperCfTemplate<K,SN,N> sTemplate, ColumnFactory columnFactory)
           
 
Method Summary
 SuperCfUpdater<K,SN,N> addKey(K key)
           
 SuperCfUpdater<K,SN,N> addSuperColumn(SN sColumnName)
           
 void deleteSubColumn(N columnName)
           
 void deleteSuperColumn()
          Deletes the super column and all of its sub columns
 SN getCurrentSuperColumn()
           
 void setBoolean(N subColumnName, Boolean value)
           
 void setByteArray(N subColumnName, byte[] value)
           
 void setByteBuffer(N subColumnName, ByteBuffer value)
           
 void setDate(N subColumnName, Date value)
           
 void setDouble(N subColumnName, Double value)
           
 void setInteger(N subColumnName, Integer value)
           
 void setLong(N subColumnName, Long value)
           
 void setString(N subColumnName, String value)
           
 void setUUID(N subColumnName, UUID value)
           
<V> void
setValue(N subColumnName, V value, Serializer<V> serializer)
           
 
Methods inherited from class me.prettyprint.cassandra.service.template.AbstractTemplateUpdater
getCurrentKey, getCurrentMutator, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

template

protected SuperCfTemplate<K,SN,N> template
Constructor Detail

SuperCfUpdater

public SuperCfUpdater(SuperCfTemplate<K,SN,N> sTemplate,
                      ColumnFactory columnFactory)
Method Detail

addKey

public SuperCfUpdater<K,SN,N> addKey(K key)
Overrides:
addKey in class AbstractTemplateUpdater<K,N>

addSuperColumn

public SuperCfUpdater<K,SN,N> addSuperColumn(SN sColumnName)

getCurrentSuperColumn

public SN getCurrentSuperColumn()

deleteSuperColumn

public void deleteSuperColumn()
Deletes the super column and all of its sub columns


deleteSubColumn

public void deleteSubColumn(N columnName)

setString

public void setString(N subColumnName,
                      String value)

setUUID

public void setUUID(N subColumnName,
                    UUID value)

setLong

public void setLong(N subColumnName,
                    Long value)

setInteger

public void setInteger(N subColumnName,
                       Integer value)

setBoolean

public void setBoolean(N subColumnName,
                       Boolean value)

setByteArray

public void setByteArray(N subColumnName,
                         byte[] value)

setByteBuffer

public void setByteBuffer(N subColumnName,
                          ByteBuffer value)

setDate

public void setDate(N subColumnName,
                    Date value)

setDouble

public void setDouble(N subColumnName,
                      Double value)

setValue

public <V> void setValue(N subColumnName,
                         V value,
                         Serializer<V> serializer)


Copyright © 2011. All Rights Reserved.