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 aSubRequestIterator
instance based on anIterator
that iterates onSubRequest
instances.- Version:
- 3.1.0
- Author:
- Frank Fock
-
-
Constructor Summary
Constructors Constructor Description SubRequestIteratorSupport(Iterator<?> subRequests)
Creates aSubRequestIterator
that decorates anIterator
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
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).S
next()
Gets the next sub-request that is pending.void
remove()
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
SubRequestIteratorSupport
public SubRequestIteratorSupport(Iterator<?> subRequests)
Creates aSubRequestIterator
that decorates anIterator
.- Parameters:
subRequests
- anIterator
onSubRequest
instances or instances of other objects ifmapToSubRequest(Object element)
is implemented (overwritten) accordingly.
-
-
Method Detail
-
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
public S 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
protected S mapToSubRequest(Object element)
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.
-
-