private ResourceGenerator loadCommonGenerator ( String resourcePath ) { ResourceGenerator generator = null ; for ( Entry < ResourceGeneratorResolver , Class < ? > > entry : commonGenerators . entrySet ( ) ) { ResourceGeneratorResolver resolver = entry . getKey ( ) ; if ( resolver . matchPath ( resourcePath ) ) { generator = ( ResourceGenerator ) ClassLoaderResourceUtils . buildObjectInstance ( entry . getValue ( ) ) ; if ( ! generator . getResolver ( ) . isSameAs ( resolver ) ) { throw new BundlingProcessException ( "The resolver defined for " + generator . getClass ( ) . getName ( ) + " is different from the one expected by Jawr." ) ; } if ( resolver . getType ( ) . equals ( ResolverType . PREFIXED ) ) { loadGeneratorIfNeeded ( resolver . getResourcePath ( resourcePath ) ) ; } } } if ( generator != null ) { initGenerator ( generator ) ; } return generator ; }
Lazy loads generators to avoid the need for undesired dependencies .