public String processAndMerge ( final List < Resource > resources , final ProcessingCriteria criteria ) throws IOException { notNull ( criteria ) ; LOG . debug ( "criteria: {}" , criteria ) ; callbackRegistry . onBeforeMerge ( ) ; try { notNull ( resources ) ; LOG . debug ( "process and merge resources: {}" , resources ) ; final StringBuffer result = new StringBuffer ( ) ; if ( shouldRunInParallel ( resources ) ) { result . append ( runInParallel ( resources , criteria ) ) ; } else { for ( final Resource resource : resources ) { LOG . debug ( "\tmerging resource: {}" , resource ) ; result . append ( applyPreProcessors ( resource , criteria ) ) ; } } return result . toString ( ) ; } finally { callbackRegistry . onAfterMerge ( ) ; } }
Apply preProcessors on resources and merge them .