boolean handleFilters ( Map < String , Object > filters ) { Validate . notNull ( filters , "Filters required" ) ; boolean changed = false ; // clear non active filters and remove them from lastFilters for ( Object filterKey : CollectionUtils . subtract ( lastFilters . keySet ( ) , filters . keySet ( ) ) ) { BeanProperty . clearBeanProperty ( adaptee , ( String ) filterKey ) ; lastFilters . remove ( filterKey ) ; changed = true ; } // set changed active filters for ( Entry < String , Object > entry : filters . entrySet ( ) ) { if ( ! lastFilters . containsKey ( entry . getKey ( ) ) || ! entry . getValue ( ) . equals ( lastFilters . get ( entry . getKey ( ) ) ) ) { BeanProperty . setBeanProperty ( adaptee , entry . getKey ( ) , entry . getValue ( ) ) ; lastFilters . put ( entry . getKey ( ) , entry . getValue ( ) ) ; changed = true ; } } return changed ; }
Clears previously passed filters sets new filters on adaptee .