org.mule.streaming
Class PagingDelegateWrapper<T>

java.lang.Object
  extended by org.mule.streaming.PagingDelegate<T>
      extended by org.mule.streaming.PagingDelegateWrapper<T>
All Implemented Interfaces:
Closeable

public class PagingDelegateWrapper<T>
extends PagingDelegate<T>

This implementation of PagingDelegate takes care of enforcing some basic behaviour of the delegate contract so that users don't have to. Concerns such as logging, auto closing the delegate if the consumer has been fully consumed, etc are addressed here

Since:
3.5.0

Constructor Summary
PagingDelegateWrapper(PagingDelegate<T> wrapped)
           
 
Method Summary
 void close()
          Closes the resource.
 List<T> getPage()
          Returns the next page of items.
 int getTotalResults()
          returns the total amount of items in the unpaged resultset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagingDelegateWrapper

public PagingDelegateWrapper(PagingDelegate<T> wrapped)
Method Detail

getPage

public List<T> getPage()
Returns the next page of items. If the return value is null or an empty list, then it means no more items are available This implementation already takes care of returning null if the delegate is closed or if the obtained page is null or empty. It delegates into the wrapped instance to actually obtain the page.

Specified by:
getPage in class PagingDelegate<T>
Returns:
a populated list of elements. null or an empty list, then it means no more items are available

close

public void close()
           throws MuleException
Closes the resource. Calling this method is mandatory for any component using this instance once it finishes using it. This method should not throw exception is invoked on an instance that has already been closed Sets the closed flag to true and then delegates into the wrapped instance

Throws:
MuleException - if an exception occurs closing the resource

getTotalResults

public int getTotalResults()
returns the total amount of items in the unpaged resultset. In some scenarios, it might not be possible/convenient to actually retrieve this value. -1 is returned in such a case. Delegetes into the wrapped instance

Specified by:
getTotalResults in class PagingDelegate<T>


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.