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

java.lang.Object
  extended by me.prettyprint.cassandra.service.template.AbstractResultWrapper<K,N>
Type Parameters:
K - the type of the key
N - the standard column name type or the super column's child column type
All Implemented Interfaces:
Iterator<ColumnFamilyResult<K,N>>, ColumnFamilyResult<K,N>, ResultStatus
Direct Known Subclasses:
ColumnFamilyResultWrapper, SuperCfResultWrapper

public abstract class AbstractResultWrapper<K,N>
extends Object
implements ColumnFamilyResult<K,N>

Provides access to the current row of data during queries. There is a lot of overlap in needs for both standard and super queries. This class consolidates what they have in common. All data is read into ByteBuffers and translated to a primitive type when requested. This class is a non-static inner class which inherits the Java generic parameters of it's containing ColumnFamilyTemplate instance. This allows it to inherit the parameter from ColumnFamilyTemplate. The parameters allows this to be used by standard and super column queries

Author:
david, zznate

Field Summary
protected  Serializer<N> columnNameSerializer
           
protected  Serializer<K> keySerializer
           
protected  ResultStatus resultStatus
           
 
Constructor Summary
AbstractResultWrapper(Serializer<K> keySerializer, Serializer<N> columnNameSerializer, ResultStatus resultStatus)
           
 
Method Summary
 Boolean getBoolean(N columnName)
           
 byte[] getByteArray(N columnName)
           
abstract  ByteBuffer getColumnValue(N columnName)
           
 Date getDate(N columnName)
           
 long getExecutionTimeMicro()
          How long the operation took to execute in MICRO-seconds.
 long getExecutionTimeNano()
           
 CassandraHost getHostUsed()
          The CassandraHost on which this operation was successful
 Integer getInteger(N columnName)
           
 Long getLong(N columnName)
           
 String getString(N columnName)
           
 UUID getUUID(N columnName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface me.prettyprint.cassandra.service.template.ColumnFamilyResult
getColumn, getColumnNames, getKey, hasResults
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Field Detail

keySerializer

protected Serializer<K> keySerializer

columnNameSerializer

protected Serializer<N> columnNameSerializer

resultStatus

protected ResultStatus resultStatus
Constructor Detail

AbstractResultWrapper

public AbstractResultWrapper(Serializer<K> keySerializer,
                             Serializer<N> columnNameSerializer,
                             ResultStatus resultStatus)
Method Detail

getColumnValue

public abstract ByteBuffer getColumnValue(N columnName)

getUUID

public UUID getUUID(N columnName)
Specified by:
getUUID in interface ColumnFamilyResult<K,N>

getString

public String getString(N columnName)
Specified by:
getString in interface ColumnFamilyResult<K,N>

getLong

public Long getLong(N columnName)
Specified by:
getLong in interface ColumnFamilyResult<K,N>

getInteger

public Integer getInteger(N columnName)
Specified by:
getInteger in interface ColumnFamilyResult<K,N>

getBoolean

public Boolean getBoolean(N columnName)
Specified by:
getBoolean in interface ColumnFamilyResult<K,N>

getByteArray

public byte[] getByteArray(N columnName)
Specified by:
getByteArray in interface ColumnFamilyResult<K,N>

getDate

public Date getDate(N columnName)
Specified by:
getDate in interface ColumnFamilyResult<K,N>

getExecutionTimeMicro

public long getExecutionTimeMicro()
Description copied from interface: ResultStatus
How long the operation took to execute in MICRO-seconds. Internally this is usually the difference between two calls of System.nanoTime() divided by 1000

Specified by:
getExecutionTimeMicro in interface ResultStatus
Returns:

getExecutionTimeNano

public long getExecutionTimeNano()
Specified by:
getExecutionTimeNano in interface ResultStatus

getHostUsed

public CassandraHost getHostUsed()
Description copied from interface: ResultStatus
The CassandraHost on which this operation was successful

Specified by:
getHostUsed in interface ResultStatus


Copyright © 2011. All Rights Reserved.