com.antelmann.util
Class OffsetFilter<T>
java.lang.Object
com.antelmann.util.OffsetFilter<T>
- All Implemented Interfaces:
- CascadingFilter<T>, Filter<T>, Wrapped<Filter<? super T>>
public class OffsetFilter<T>
- extends Object
- implements CascadingFilter<T>, Wrapped<Filter<? super T>>
a filter that specifies to a supporting implementation that not all results are desired,
but only those starting at a given offset and limited to a given limit.
By itself, it maintains a counter that controls the accept method.
This filter is supported by JDBCRowStore to limit the returned result;
only the inner filter is given to the mapper.
- Since:
- 29.08.2009, 12:09:59
- Author:
- Holger Antelmann
- See Also:
JDBCRowStore.fetch(Filter),
JDBCRowStore.fetchStubs(Filter)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OffsetFilter
public OffsetFilter(int limit)
OffsetFilter
public OffsetFilter(int limit,
Filter<? super T> innerFilter)
OffsetFilter
public OffsetFilter(int offset,
int limit,
Filter<? super T> innerFilter)
- Parameters:
offset - allows to start not at the first row, but at the given offset (0 means to start at the beginning)limit - specifies the maximum number of rows to be consideredinnerFilter - the actual filter that will be used by the mapper
createNextFilter
public OffsetFilter<T> createNextFilter()
- returns a new filter that moves the offset by the limit
getOffset
public int getOffset()
getLimit
public int getLimit()
resetCounter
public void resetCounter()
accept
public boolean accept(T entry)
- Description copied from interface:
Filter
- returns true only if the given entry is accepted by this filter
- Specified by:
accept in interface Filter<T>
unwrap
public Filter<? super T> unwrap()
- Description copied from interface:
Wrapped
- returns the embedded instance that this wrapper encloses
- Specified by:
unwrap in interface Wrapped<Filter<? super T>>
getInnerFilter
public Filter<? super T> getInnerFilter()
- Specified by:
getInnerFilter in interface CascadingFilter<T>
setInnerFilter
public void setInnerFilter(Filter<? super T> filter)
- Specified by:
setInnerFilter in interface CascadingFilter<T>
(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads