@ Override public boolean filter ( Object data ) { logger . entering ( data ) ; String [ ] keyValues = filterKeyValues . split ( "," ) ; String tempKey = null ; Field field ; try { field = data . getClass ( ) . getDeclaredField ( filterKeyName ) ; field . setAccessible ( true ) ; for ( String keyValue : keyValues ) { tempKey = keyValue ; if ( field . get ( data ) != null && field . get ( data ) . toString ( ) . trim ( ) . equals ( keyValue ) ) { logger . exiting ( true ) ; return true ; } } } catch ( NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e ) { throw new DataProviderException ( "Row with key '" + tempKey + "' is not found for given filter key '" + filterKeyName + "'" , e ) ; } logger . exiting ( false ) ; return false ; }
This function identifies whether the object falls in the filtering criteria or not based on the filterKeyName and its corresponding filterKeyValues .