public abstract class ResultBase<K,T extends Persistent> extends Object implements Result<K,T>
Result
implementations.Modifier and Type | Field and Description |
---|---|
protected DataStore<K,T> |
dataStore |
protected K |
key |
protected long |
limit
Query limit
|
protected long |
offset
How far we have proceeded
|
protected T |
persistent |
protected Query<K,T> |
query |
Constructor and Description |
---|
ResultBase(DataStore<K,T> dataStore,
Query<K,T> query) |
Modifier and Type | Method and Description |
---|---|
protected void |
clear() |
void |
close() |
protected boolean |
filter(K key,
T persistent) |
T |
get()
Returns the current object.
|
DataStore<K,T> |
getDataStore()
Returns the DataStore, that this Result is associated with.
|
K |
getKey()
Returns the current key.
|
Class<K> |
getKeyClass()
Returns the class of the keys
|
long |
getOffset()
Returns the number of times next() is called with return value true.
|
protected T |
getOrCreatePersistent(T persistent) |
Class<T> |
getPersistentClass()
Returns the class of the persistent objects
|
Query<K,T> |
getQuery()
Returns the Query object for this Result.
|
protected boolean |
isLimitReached()
Returns whether the limit for the query is reached.
|
boolean |
next()
Advances to the next element and returns false if at end.
|
protected abstract boolean |
nextInner()
next() calls this function to read the
actual results. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProgress
protected final DataStore<K,T extends Persistent> dataStore
protected final Query<K,T extends Persistent> query
protected K key
protected T extends Persistent persistent
protected long limit
protected long offset
public DataStore<K,T> getDataStore()
Result
getDataStore
in interface Result<K,T extends Persistent>
public Query<K,T> getQuery()
Result
getQuery
in interface Result<K,T extends Persistent>
public T get()
Result
get
in interface Result<K,T extends Persistent>
public K getKey()
Result
getKey
in interface Result<K,T extends Persistent>
public Class<K> getKeyClass()
Result
getKeyClass
in interface Result<K,T extends Persistent>
public Class<T> getPersistentClass()
Result
getPersistentClass
in interface Result<K,T extends Persistent>
protected boolean isLimitReached()
protected void clear()
public final boolean next() throws Exception, IOException
Result
next
in interface Result<K,T extends Persistent>
Exception
IOException
public long getOffset()
Result
getOffset
in interface Result<K,T extends Persistent>
protected abstract boolean nextInner() throws IOException
next()
calls this function to read the
actual results.IOException
protected T getOrCreatePersistent(T persistent) throws Exception, IOException
Exception
IOException
public void close() throws IOException
close
in interface Result<K,T extends Persistent>
IOException
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.