com.jenkov.mrpersister.impl.filter
Class AcceptAllReadFilter

java.lang.Object
  extended by com.jenkov.mrpersister.impl.filter.AcceptAllReadFilter
All Implemented Interfaces:
IReadFilter

public class AcceptAllReadFilter
extends java.lang.Object
implements IReadFilter

This read filter implementation accepts all records as the object(s) read. This filter is used as default filter in case null is passed as filter to a read method taking a filter. This means null = no filtering = all records accepted.


Field Summary
static IReadFilter ACCEPT_ALL_FILTER
           
 
Constructor Summary
AcceptAllReadFilter()
           
 
Method Summary
 boolean accept(java.sql.ResultSet result)
          Returns true if the filter can accept the record at the current position of the result set as part of the objects read.
 void acceptedByAllFilters(boolean wasAcceptedByAllFilters)
          If the filter is used in a combined filter, this filter can be told whether all other filters accepted this record, or not.
 boolean acceptMore()
          Returns true if the filter will accept anymore records at all.
 void clear()
          This method is called when all reading is done.
 void init(java.sql.ResultSet result)
          Called by the object reader before reading starts taking place.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCEPT_ALL_FILTER

public static final IReadFilter ACCEPT_ALL_FILTER
Constructor Detail

AcceptAllReadFilter

public AcceptAllReadFilter()
Method Detail

init

public void init(java.sql.ResultSet result)
          throws java.sql.SQLException,
                 PersistenceException
Description copied from interface: IReadFilter
Called by the object reader before reading starts taking place. Can be used to manipulate the result set before the reading takes place, for instance, moving the result set forward to a certain record. This way paged reading can be implemented.

Specified by:
init in interface IReadFilter
Parameters:
result - The ResultSet to initialize.
Throws:
java.sql.SQLException
PersistenceException

accept

public boolean accept(java.sql.ResultSet result)
               throws java.sql.SQLException,
                      PersistenceException
Description copied from interface: IReadFilter
Returns true if the filter can accept the record at the current position of the result set as part of the objects read. False if the filter doesn't want this record to be part of the list of objects read.

Specified by:
accept in interface IReadFilter
Parameters:
result - The ResultSet instance apply the filter filter to.
Returns:
True if the filter accepts the current record. False if not.
Throws:
java.sql.SQLException
PersistenceException

acceptMore

public boolean acceptMore()
Description copied from interface: IReadFilter
Returns true if the filter will accept anymore records at all. False if not. This can for instance be used to stop the reading after a certain amount of records has been accepted, for paged reading.

Specified by:
acceptMore in interface IReadFilter
Returns:
True if the filter will accept anymore records at all. False if not.

acceptedByAllFilters

public void acceptedByAllFilters(boolean wasAcceptedByAllFilters)
Description copied from interface: IReadFilter
If the filter is used in a combined filter, this filter can be told whether all other filters accepted this record, or not. This may be useful for instance in a paged filter, that wants 10 records total, but only wants to count accepted records if other filters also accepts the records.

Specified by:
acceptedByAllFilters in interface IReadFilter
Parameters:
wasAcceptedByAllFilters - Will be set to true if all filters in a combined filter accepted the current record. Will be set to false if just one single filter do not accept the current record.

clear

public void clear()
Description copied from interface: IReadFilter
This method is called when all reading is done. This gives the filter a chance to clean up any objects instantiated during filtering.

Specified by:
clear in interface IReadFilter