protected List < ResultConfig > buildResultConfigs ( Class < ? > clazz , PackageConfig . Builder pcb ) { List < ResultConfig > configs = CollectUtils . newArrayList ( ) ; // load annotation results Result [ ] results = new Result [ 0 ] ; Results rs = clazz . getAnnotation ( Results . class ) ; if ( null == rs ) { org . beangle . struts2 . annotation . Action an = clazz . getAnnotation ( org . beangle . struts2 . annotation . Action . class ) ; if ( null != an ) results = an . results ( ) ; } else { results = rs . value ( ) ; } Set < String > annotationResults = CollectUtils . newHashSet ( ) ; if ( null != results ) { for ( Result result : results ) { String resultType = result . type ( ) ; if ( Strings . isEmpty ( resultType ) ) resultType = "dispatcher" ; ResultTypeConfig rtc = pcb . getResultType ( resultType ) ; ResultConfig . Builder rcb = new ResultConfig . Builder ( result . name ( ) , rtc . getClassName ( ) ) ; if ( null != rtc . getDefaultResultParam ( ) ) rcb . addParam ( rtc . getDefaultResultParam ( ) , result . location ( ) ) ; configs . add ( rcb . build ( ) ) ; annotationResults . add ( result . name ( ) ) ; } } // load ftl convension results if ( ! preloadftl || null == profileService ) return configs ; String extention = profileService . getProfile ( clazz . getName ( ) ) . getViewExtension ( ) ; if ( ! extention . equals ( "ftl" ) ) return configs ; ResultTypeConfig rtc = pcb . getResultType ( "freemarker" ) ; for ( Method m : clazz . getMethods ( ) ) { String methodName = m . getName ( ) ; if ( ! annotationResults . contains ( methodName ) && shouldGenerateResult ( m ) ) { String path = templateFinder . find ( clazz , methodName , methodName , extention ) ; if ( null != path ) { configs . add ( new ResultConfig . Builder ( m . getName ( ) , rtc . getClassName ( ) ) . addParam ( rtc . getDefaultResultParam ( ) , path ) . build ( ) ) ; } } } return configs ; }
generator default results by method name