Module org.snmp4j.agent
Package org.snmp4j.agent.request
Class SubRequestIteratorSupport<S extends SubRequest<?>>
java.lang.Object
org.snmp4j.agent.request.SubRequestIteratorSupport<S>
- All Implemented Interfaces:
Iterator<S>
,SubRequestIterator<S>
public class SubRequestIteratorSupport<S extends SubRequest<?>>
extends Object
implements SubRequestIterator<S>
This support class allows to implement a
SubRequestIterator
instance based on an Iterator
that iterates on SubRequest
instances.- Version:
- 3.1.0
- Author:
- Frank Fock
-
Constructor Summary
ConstructorDescriptionSubRequestIteratorSupport
(Iterator<?> subRequests) Creates aSubRequestIterator
that decorates anIterator
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
Returnstrue
if there are more sub-requests to process.protected S
mapToSubRequest
(Object element) Returns theSubRequest
contained or represented by the supplied object (element of the iterator).next()
Gets the next sub-request that is pending.void
remove()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
SubRequestIteratorSupport
Creates aSubRequestIterator
that decorates anIterator
.- Parameters:
subRequests
- anIterator
onSubRequest
instances or instances of other objects ifmapToSubRequest(Object element)
is implemented (overwritten) accordingly.
-
-
Method Details
-
hasNext
public boolean hasNext()Description copied from interface:SubRequestIterator
Returnstrue
if there are more sub-requests to process. In other words, returnstrue
if next would return an element rather than throwing an exception.- Specified by:
hasNext
in interfaceIterator<S extends SubRequest<?>>
- Specified by:
hasNext
in interfaceSubRequestIterator<S extends SubRequest<?>>
- Returns:
true
if there are more sub-requests.
-
next
Description copied from interface:SubRequestIterator
Gets the next sub-request that is pending.- Specified by:
next
in interfaceIterator<S extends SubRequest<?>>
- Specified by:
next
in interfaceSubRequestIterator<S extends SubRequest<?>>
- Returns:
- an unprocessed
SubRequest
instance.
-
remove
public void remove()- Specified by:
remove
in interfaceIterator<S extends SubRequest<?>>
-
mapToSubRequest
Returns theSubRequest
contained or represented by the supplied object (element of the iterator). The default implementation simply casts the supplied object toSubRequest
.- Parameters:
element
- an Object from which aSubRequest
can be deduced.- Returns:
- a
SubRequest
instance.
-