public static int insertJavaDocAsAnnotations ( final Log log , final String encoding , final File outputDir , final SearchableDocumentation docs , final JavaDocRenderer renderer ) { // Check sanity Validate . notNull ( docs , "docs" ) ; Validate . notNull ( log , "log" ) ; Validate . notNull ( outputDir , "outputDir" ) ; Validate . isTrue ( outputDir . isDirectory ( ) , "'outputDir' must be a Directory." ) ; Validate . notNull ( renderer , "renderer" ) ; int processedXSDs = 0 ; final List < File > foundFiles = new ArrayList < File > ( ) ; addRecursively ( foundFiles , RECURSIVE_XSD_FILTER , outputDir ) ; if ( foundFiles . size ( ) > 0 ) { // Create the processors. final XsdAnnotationProcessor classProcessor = new XsdAnnotationProcessor ( docs , renderer ) ; final XsdEnumerationAnnotationProcessor enumProcessor = new XsdEnumerationAnnotationProcessor ( docs , renderer ) ; for ( File current : foundFiles ) { // Create an XSD document from the current File. final Document generatedSchemaFileDocument = parseXmlToDocument ( current ) ; // Replace all namespace prefixes within the provided document. process ( generatedSchemaFileDocument . getFirstChild ( ) , true , classProcessor ) ; processedXSDs ++ ; // Overwrite the vanilla file. savePrettyPrintedDocument ( generatedSchemaFileDocument , current , encoding ) ; } } else { if ( log . isWarnEnabled ( ) ) { log . warn ( "Found no generated 'vanilla' XSD files to process under [" + FileSystemUtilities . getCanonicalPath ( outputDir ) + "]. Aborting processing." ) ; } } // All done. return processedXSDs ; }
Inserts XML documentation annotations into all generated XSD files found within the supplied outputDir .