org.snmp4j.agent.request
Class SubRequestIteratorSupport

java.lang.Object
  extended by org.snmp4j.agent.request.SubRequestIteratorSupport
All Implemented Interfaces:
java.util.Iterator<SubRequest>, SubRequestIterator

public class SubRequestIteratorSupport
extends java.lang.Object
implements SubRequestIterator

This support class allows to implement a SubRequestIterator instance based on an Iterator that iterates on SubRequest instances.

Version:
1.0
Author:
Frank Fock

Constructor Summary
SubRequestIteratorSupport(java.util.Iterator subRequests)
          Creates a SubRequestIterator that decorates an Iterator.
 
Method Summary
 boolean hasNext()
          Returns true if there are more sub-requests to process.
protected  SubRequest mapToSubRequest(java.lang.Object element)
          Returns the SubRequest contained or represented by the supplied object (element of the iterator).
 SubRequest 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
 

Constructor Detail

SubRequestIteratorSupport

public SubRequestIteratorSupport(java.util.Iterator subRequests)
Creates a SubRequestIterator that decorates an Iterator.

Parameters:
subRequests - an Iterator on SubRequest instances or instances of other objects if mapToSubRequest(Object element) is implemented (overwritten) accordingly.
Method Detail

hasNext

public boolean hasNext()
Description copied from interface: SubRequestIterator
Returns true if there are more sub-requests to process. In other words, returns true if next would return an element rather than throwing an exception.

Specified by:
hasNext in interface java.util.Iterator<SubRequest>
Specified by:
hasNext in interface SubRequestIterator
Returns:
true if there are more sub-requests.

next

public SubRequest next()
Description copied from interface: SubRequestIterator
Gets the next sub-request that is pending.

Specified by:
next in interface java.util.Iterator<SubRequest>
Specified by:
next in interface SubRequestIterator
Returns:
an unprocessed SubRequest instance.

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<SubRequest>

mapToSubRequest

protected SubRequest mapToSubRequest(java.lang.Object element)
Returns the SubRequest contained or represented by the supplied object (element of the iterator). The default implementation simply casts the supplied object to SubRequest.

Parameters:
element - an Object from which a SubRequest can be deduced.
Returns:
a SubRequest instance.

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.