me.prettyprint.cassandra.service.template
Class SuperCfUpdater<K,SN,N>
java.lang.Object
me.prettyprint.cassandra.service.template.AbstractTemplateUpdater<K,N>
me.prettyprint.cassandra.service.template.SuperCfUpdater<K,SN,N>
- Type Parameters:
K
- the key's data typeSN
- the standard or super column's data typeN
- the child column name type in a super columnV
- 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
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)
|
|
setValue(N subColumnName,
V value,
Serializer<V> serializer)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
template
protected SuperCfTemplate<K,SN,N> template
SuperCfUpdater
public SuperCfUpdater(SuperCfTemplate<K,SN,N> sTemplate,
ColumnFactory columnFactory)
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.