class MongoMappingCursor<T,U> extends java.lang.Object implements MongoCursor<U>
Modifier and Type | Field and Description |
---|---|
private Function<T,U> |
mapper |
private MongoCursor<T> |
proxied |
Constructor and Description |
---|
MongoMappingCursor(MongoCursor<T> proxied,
Function<T,U> mapper) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
ServerAddress |
getServerAddress()
Returns the server address
|
ServerCursor |
getServerCursor()
Returns the server cursor, which can be null if the no cursor was created or if the cursor has been exhausted or killed.
|
boolean |
hasNext() |
U |
next() |
void |
remove() |
U |
tryNext()
A special
next() case that returns the next element in the iteration if available or null. |
private final MongoCursor<T> proxied
public MongoMappingCursor(MongoCursor<T> proxied, Function<T,U> mapper)
public void close()
close
in interface MongoCursor<U>
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public boolean hasNext()
hasNext
in interface MongoCursor<U>
hasNext
in interface java.util.Iterator<U>
public U next()
next
in interface MongoCursor<U>
next
in interface java.util.Iterator<U>
public U tryNext()
MongoCursor
next()
case that returns the next element in the iteration if available or null.
Tailable cursors are an example where this is useful. A call to tryNext()
may return null, but in the future calling
tryNext()
would return a new element if a document had been added to the capped collection.
tryNext
in interface MongoCursor<U>
public void remove()
remove
in interface java.util.Iterator<U>
public ServerCursor getServerCursor()
MongoCursor
getServerCursor
in interface MongoCursor<U>
public ServerAddress getServerAddress()
MongoCursor
getServerAddress
in interface MongoCursor<U>