protected Loader < ? > getAggregateTemplateLoader ( Loader < ? > [ ] templateLoaders ) { int loaderCount = ( templateLoaders == null ) ? 0 : templateLoaders . length ; switch ( loaderCount ) { case 0 : // Register default template loaders. Loader < ? > stringLoader = new StringLoader ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Pebble Engine Template Loader not specified. Default Template Loader registered: " + stringLoader ) ; } return stringLoader ; case 1 : if ( log . isDebugEnabled ( ) ) { log . debug ( "One Pebble Engine Template Loader registered: " + templateLoaders [ 0 ] ) ; } return templateLoaders [ 0 ] ; default : List < Loader < ? > > defaultLoadingStrategies = new ArrayList <> ( ) ; Collections . addAll ( defaultLoadingStrategies , templateLoaders ) ; Loader < ? > delegatingLoader = new DelegatingLoader ( defaultLoadingStrategies ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Multiple Pebble Engine Template Loader registered: " + delegatingLoader ) ; } return delegatingLoader ; } }
Return a Template Loader based on the given Template Loader list . If more than one Template Loader has been registered a DelegatingLoader needs to be created .