コード例 #1
0
 /**
  * Prints an output example for the given extractor.
  *
  * @param extractorName the extractor name
  * @param registry
  * @throws IOException raised if no extractor is found with that name
  * @throws ExtractionException
  */
 public void printExampleOutput(String extractorName, ExtractorRegistry registry)
     throws IOException, ExtractionException {
   ExtractorFactory<?> factory = getFactory(registry, extractorName);
   ExampleInputOutput example = new ExampleInputOutput(factory);
   String output = example.getExampleOutput();
   if (output == null) {
     throw new IllegalArgumentException(
         "Extractor " + extractorName + " provides no example output");
   }
   System.out.println(output);
 }
コード例 #2
0
 /**
  * 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();
   }
 }