/** * Prints an example of input for the provided extractor. * * @param extractorName the name of the extractor * @param registry * @throws IOException raised if no extractor is found with that name */ public void printExampleInput(String extractorName, ExtractorRegistry registry) throws IOException { ExtractorFactory<?> factory = getFactory(registry, extractorName); ExampleInputOutput example = new ExampleInputOutput(factory); String input = example.getExampleInput(); if (input == null) { throw new IllegalArgumentException( "Extractor " + extractorName + " provides no example input"); } System.out.println(input); }
/** * Prints a complete report on all the available extractors. * * @throws IOException * @throws ExtractionException */ public void printReport(ExtractorRegistry registry) throws IOException, ExtractionException { for (String extractorName : registry.getAllNames()) { ExtractorFactory<?> factory = registry.getFactory(extractorName); ExampleInputOutput example = new ExampleInputOutput(factory); System.out.println("Extractor: " + extractorName); System.out.println("\ttype: " + getType(factory)); System.out.println(); final String exampleInput = example.getExampleInput(); if (exampleInput == null) { System.out.println("(No Example Available)"); } else { System.out.println("-------- Example Input --------"); System.out.println(exampleInput); System.out.println("-------- Example Output --------"); String output = example.getExampleOutput(); System.out.println( output == null || output.trim().length() == 0 ? "(No Output Generated)" : output); } System.out.println("================================"); System.out.println(); } }