Class ConvertingCursor<S,T>
java.lang.Object
org.springframework.data.redis.core.ConvertingCursor<S,T>
- Type Parameters:
S
-T
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterator<T>
,Cursor<T>
,CloseableIterator<T>
ConvertingCursor
wraps a given cursor and applies given Converter
to items prior to returning them.
This allows to easily perform required conversion whereas the underlying implementation may still work with its
native types.- Since:
- 1.4
- Author:
- Christoph Strobl
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.util.CloseableIterator
spliterator, stream
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
ConvertingCursor
- Parameters:
cursor
- Cursor must not be null.converter
- Converter must not be null.
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCloseableIterator<S>
-
getCursorId
public long getCursorId()Description copied from interface:Cursor
Get the reference cursor.
NOTE: the id might change while iterating items.- Specified by:
getCursorId
in interfaceCursor<S>
- Returns:
-
isClosed
public boolean isClosed() -
getPosition
public long getPosition()- Specified by:
getPosition
in interfaceCursor<S>
- Returns:
- the current position of the cursor.
-