private Set < PageBook . Page > scanPagesToCompile ( Set < Class < ? > > set ) { Set < Templates . Descriptor > templates = Sets . newHashSet ( ) ; Set < PageBook . Page > pagesToCompile = Sets . newHashSet ( ) ; for ( Class < ? > pageClass : set ) { EmbedAs embedAs = pageClass . getAnnotation ( EmbedAs . class ) ; if ( null != embedAs ) { final String embedName = embedAs . value ( ) ; //is this a text rendering or embedding-style widget? if ( Renderable . class . isAssignableFrom ( pageClass ) ) { @ SuppressWarnings ( "unchecked" ) Class < ? extends Renderable > renderable = ( Class < ? extends Renderable > ) pageClass ; registry . add ( embedName , renderable ) ; } else { pagesToCompile . add ( embed ( embedName , pageClass ) ) ; } } At at = pageClass . getAnnotation ( At . class ) ; if ( null != at ) { if ( pageClass . isAnnotationPresent ( Service . class ) ) { pagesToCompile . add ( pageBook . serviceAt ( at . value ( ) , pageClass ) ) ; } else if ( pageClass . isAnnotationPresent ( Export . class ) ) { //localize the resource to the SitebricksModule's package. resourcesService . add ( SitebricksModule . class , pageClass . getAnnotation ( Export . class ) ) ; } else { pagesToCompile . add ( pageBook . at ( at . value ( ) , pageClass ) ) ; } } if ( pageClass . isAnnotationPresent ( Show . class ) ) { // This has a template associated with it. templates . add ( new Templates . Descriptor ( pageClass , pageClass . getAnnotation ( Show . class ) . value ( ) ) ) ; } } // Eagerly load all detected templates in production mode. if ( Stage . DEVELOPMENT != currentStage ) { this . templates . loadAll ( templates ) ; } return pagesToCompile ; }
goes through the set of scanned classes and builds pages out of them .