Java 类com.sun.javadoc.DocErrorReporter 实例源码

项目:monarch    文件:UnitTestDoclet.java   
public static boolean validOptions(String[][] options, DocErrorReporter reporter) {
  boolean sawOutput = false;

  for (int i = 0; i < options.length; i++) {
    String[] option = options[i];

    if (option[0].equals("-output")) {
      File output = new File(option[1]);
      if (output.exists() && output.isDirectory()) {
        reporter.printError("Output file " + output + " is a directory");
        return false;

      } else {
        sawOutput = true;
      }
    }
  }

  if (!sawOutput) {
    reporter.printError("Missing -output");
    return false;
  }

  return true;
}
项目:openjdk-jdk10    文件:Test.java   
public static boolean validOptions(String[][] options, DocErrorReporter reporter) {
    for (int i = 0 ; i < options.length; i++) {
       String opt = options[i][0].trim();
       switch (opt) {
           case "-genErrors":
               genErrors = true;
               genWarnings = false;
               break;
           case "-genWarnings":
               genErrors = false;
               genWarnings = true;
               break;
       }
    }
    return true;
}
项目:checkstyle-backport-jre6    文件:TokenTypesDoclet.java   
/**
 * Checks that only valid options was specified.
 * @param options all parsed options
 * @param reporter the reporter to report errors.
 * @return true if only valid options was specified
 */
public static boolean checkOptions(String[][] options, DocErrorReporter reporter) {
    boolean foundDestFileOption = false;
    boolean onlyOneDestFileOption = true;
    for (final String[] opt : options) {
        if (DEST_FILE_OPT.equals(opt[0])) {
            if (foundDestFileOption) {
                reporter.printError("Only one -destfile option allowed.");
                onlyOneDestFileOption = false;
                break;
            }
            foundDestFileOption = true;
        }
    }
    if (!foundDestFileOption) {
        reporter.printError("Usage: javadoc -destfile file -doclet TokenTypesDoclet ...");
    }
    return onlyOneDestFileOption && foundDestFileOption;
}
项目:closure-maven-plugin    文件:PluginConfigDoclet.java   
/** Specified for the Doclet API */
public static boolean validOptions(
    String[][] options,
    DocErrorReporter reporter) {
  ImmutableList.Builder<String[]> optionsForStandardDoclet
      = ImmutableList.builder();
  boolean ok = true;
  for (String[] optionArr : options) {
    OptionName on = OPTION_NAMES.get(optionArr[0]);
    if (on == null) {
      optionsForStandardDoclet.add(optionArr);
    } else {
      ok &= on.isValid(optionArr, reporter);
    }
  }
  ok &= Standard.validOptions(
      optionsForStandardDoclet.build().toArray(new String[0][]), reporter);
  return ok;
}
项目:freemarker-doclet    文件:FreeMarkerDoclet.java   
public static boolean validOptions(String options[][],
                                   DocErrorReporter reporter) {
    boolean foundOutput = false;
    boolean foundTemplate = false;

    for (int i = 0; i < options.length; i++) {
        String[] opt = options[i];
        if (opt[0].equals("-o")) {
            foundOutput = true;
            output = opt[1];
        } else if (opt[0].equals("-ft")) {
            foundTemplate = true;
            template = new FileTemplateOption(opt[1]);
        } else if (opt[0].equals("-ct")) {
            foundTemplate = true;
            template = new ClasspathTemplateOption(opt[1]);
        }
    }

    if (!foundOutput || !foundTemplate) {
        reporter.printError("Usage: javadoc -o OUTPUT_FILE -t TEMPLATE_FILE ...");
        return false;
    }

    return true;
}
项目:asciidoclet    文件:AsciidoctorRenderer.java   
private Options buildOptions(DocletOptions docletOptions, DocErrorReporter errorReporter) {
    OptionsBuilder opts = defaultOptions();
    if (docletOptions.baseDir().isPresent()) {
        opts.baseDir(docletOptions.baseDir().get());
    }
    if (templates.isPresent()) {
        opts.templateDir(templates.get().templateDir());
    }
    opts.attributes(buildAttributes(docletOptions, errorReporter));
    if (docletOptions.requires().size() > 0) {
        for (String require : docletOptions.requires()) {
            asciidoctor.rubyExtensionRegistry().requireLibrary(require);
        }
    }
    return opts.get();
}
项目:checkstyle    文件:TokenTypesDoclet.java   
/**
 * Checks that only valid options was specified.
 * @param options all parsed options
 * @param reporter the reporter to report errors.
 * @return true if only valid options was specified
 */
public static boolean checkOptions(String[][] options, DocErrorReporter reporter) {
    boolean foundDestFileOption = false;
    boolean onlyOneDestFileOption = true;
    for (final String[] opt : options) {
        if (DEST_FILE_OPT.equals(opt[0])) {
            if (foundDestFileOption) {
                reporter.printError("Only one -destfile option allowed.");
                onlyOneDestFileOption = false;
                break;
            }
            foundDestFileOption = true;
        }
    }
    if (!foundDestFileOption) {
        reporter.printError("Usage: javadoc -destfile file -doclet TokenTypesDoclet ...");
    }
    return onlyOneDestFileOption && foundDestFileOption;
}
项目:hadoop    文件:StabilityOptions.java   
public static void validOptions(String[][] options,
     DocErrorReporter reporter) {
   for (int i = 0; i < options.length; i++) {
     String opt = options[i][0].toLowerCase(Locale.ENGLISH);
     if (opt.equals(UNSTABLE_OPTION)) {
RootDocProcessor.stability = UNSTABLE_OPTION;
     } else if (opt.equals(EVOLVING_OPTION)) {
RootDocProcessor.stability = EVOLVING_OPTION;
     } else if (opt.equals(STABLE_OPTION)) {
RootDocProcessor.stability = STABLE_OPTION; 
     }
   }
 }
项目:ditb    文件:StabilityOptions.java   
public static void validOptions(String[][] options, DocErrorReporter reporter) {
  for (int i = 0; i < options.length; i++) {
    String opt = options[i][0].toLowerCase();
    if (opt.equals(UNSTABLE_OPTION)) {
      RootDocProcessor.stability = UNSTABLE_OPTION;
    } else if (opt.equals(EVOLVING_OPTION)) {
      RootDocProcessor.stability = EVOLVING_OPTION;
    } else if (opt.equals(STABLE_OPTION)) {
      RootDocProcessor.stability = STABLE_OPTION;
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:StabilityOptions.java   
public static void validOptions(String[][] options,
    DocErrorReporter reporter) {
  for (int i = 0; i < options.length; i++) {
    String opt = options[i][0].toLowerCase(Locale.ENGLISH);
    if (opt.equals(UNSTABLE_OPTION)) {
      RootDocProcessor.stability = UNSTABLE_OPTION;
    } else if (opt.equals(EVOLVING_OPTION)) {
      RootDocProcessor.stability = EVOLVING_OPTION;
    } else if (opt.equals(STABLE_OPTION)) {
      RootDocProcessor.stability = STABLE_OPTION;
    }
  }
}
项目:webframework    文件:ScriptingObjectDoclet.java   
public static boolean validOptions(final String[][] options, final DocErrorReporter reporter) {
    System.out.println("VALIDATING OPTIONS");
    final Options opt = new Options(options);
    if ((opt.factoryNames.size() == 0) || (opt.outputPath == null)) {
        reporter.printError("Usage: -factory com.example.MyClass -destDir <outputFolder> [ -json ] [ -nohtml ]");
        return false;
    }
    return true;
}
项目:maxur-ldoc    文件:LivingDocumentation.java   
/**
 * Valid options boolean.
 *
 * @param options  the options
 * @param reporter the reporter
 * @return the boolean
 */
public static boolean validOptions(final String[][] options, final DocErrorReporter reporter) {
    try {
        Options.validate(options);
    } catch (IllegalStateException e) {
        log.debug(e.getMessage(), e);
        reporter.printError(e.getMessage());
        return false;
    }
    return true;
}
项目:big-c    文件:StabilityOptions.java   
public static void validOptions(String[][] options,
     DocErrorReporter reporter) {
   for (int i = 0; i < options.length; i++) {
     String opt = options[i][0].toLowerCase(Locale.ENGLISH);
     if (opt.equals(UNSTABLE_OPTION)) {
RootDocProcessor.stability = UNSTABLE_OPTION;
     } else if (opt.equals(EVOLVING_OPTION)) {
RootDocProcessor.stability = EVOLVING_OPTION;
     } else if (opt.equals(STABLE_OPTION)) {
RootDocProcessor.stability = STABLE_OPTION; 
     }
   }
 }
项目:umldoclet    文件:RendererTest.java   
@Before
public void setUp() {
    mockReporter = Mockito.mock(DocErrorReporter.class);
    UMLDocletConfig config = new UMLDocletConfig(new String[0][], mockReporter);

    renderer = new YabadabadooRenderer(new DiagramRenderer(config));
}
项目:umldoclet    文件:UMLDocletConfigTest.java   
@Test
public void testSplitDefaultValue() {
    UMLDocletConfig config = new UMLDocletConfig(new String[0][], mock(DocErrorReporter.class));
    assertThat(config.excludedReferences(), is(equalTo((Collection<String>) asList(
            Object.class.getName(), Enum.class.getName(), Annotation.class.getName()
    ))));
}
项目:umldoclet    文件:UMLDocletConfigTest.java   
@Test
public void testSplitMultipleOccurrances() {
    UMLDocletConfig config = new UMLDocletConfig(new String[][]{
            {"-umlExcludedReferences", Object.class.getName()},
            {"-umlExcludedReferences", Enum.class.getName()}
    }, mock(DocErrorReporter.class));

    assertThat(config.excludedReferences(), is(equalTo((Collection<String>) asList(
            Object.class.getName(), Enum.class.getName()
    ))));
}
项目:umldoclet    文件:UMLDocletConfigTest.java   
@Test
public void testIssue37_packagePrivateClassesDefaultValue() {
    UMLDocletConfig config = new UMLDocletConfig(new String[0][], mock(DocErrorReporter.class));
    ClassDoc packagePrivateClassDoc = mock(ClassDoc.class);
    when(packagePrivateClassDoc.isPackagePrivate()).thenReturn(true);
    when(packagePrivateClassDoc.tags(anyString())).thenReturn(new Tag[0]);
    when(packagePrivateClassDoc.annotations()).thenReturn(new AnnotationDesc[0]);

    assertThat(config.includeClass(packagePrivateClassDoc), is(false));
}
项目:openjfx-8u-dev-tests    文件:Template.java   
public static boolean validOptions(String options[][],
        DocErrorReporter reporter) throws IOException {
    for (int i = 0; i < options.length; i++) {
        String[] opt = options[i];
        if (opt[0].equals("-template")) {
            out = new PrintStream(opt[1]);
        }
    }
    return true;
}
项目:javify    文件:HtmlRepairer.java   
public HtmlRepairer(DocErrorReporter warningReporter,
                    boolean noWarn, boolean noEmailWarn,
                    ClassDoc contextClass, MemberDoc contextMember,
                    boolean throwAwayLeadingPara) {
   this.warningReporter = warningReporter;
   this.noWarn = noWarn;
   this.noEmailWarn = noEmailWarn;
   this.contextClass = contextClass;
   this.contextMember = contextMember;
   this.throwAwayLeadingPara = throwAwayLeadingPara;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:StabilityOptions.java   
public static void validOptions(String[][] options,
     DocErrorReporter reporter) {
   for (int i = 0; i < options.length; i++) {
     String opt = options[i][0].toLowerCase();
     if (opt.equals(UNSTABLE_OPTION)) {
RootDocProcessor.stability = UNSTABLE_OPTION;
     } else if (opt.equals(EVOLVING_OPTION)) {
RootDocProcessor.stability = EVOLVING_OPTION;
     } else if (opt.equals(STABLE_OPTION)) {
RootDocProcessor.stability = STABLE_OPTION; 
     }
   }
 }
项目:jvm-stm    文件:HtmlRepairer.java   
public HtmlRepairer(DocErrorReporter warningReporter, 
      boolean noWarn, boolean noEmailWarn,
      ClassDoc contextClass, MemberDoc contextMember,
                    boolean throwAwayLeadingPara) {
   this.warningReporter = warningReporter;
   this.noWarn = noWarn;
   this.noEmailWarn = noEmailWarn;
   this.contextClass = contextClass;
   this.contextMember = contextMember;
   this.throwAwayLeadingPara = throwAwayLeadingPara;
}
项目:hadoop-plus    文件:StabilityOptions.java   
public static void validOptions(String[][] options,
     DocErrorReporter reporter) {
   for (int i = 0; i < options.length; i++) {
     String opt = options[i][0].toLowerCase();
     if (opt.equals(UNSTABLE_OPTION)) {
RootDocProcessor.stability = UNSTABLE_OPTION;
     } else if (opt.equals(EVOLVING_OPTION)) {
RootDocProcessor.stability = EVOLVING_OPTION;
     } else if (opt.equals(STABLE_OPTION)) {
RootDocProcessor.stability = STABLE_OPTION; 
     }
   }
 }
项目:dependometer    文件:Doclet.java   
public static boolean validOptions(java.lang.String[][] options, DocErrorReporter rep)
{
   assert options != null;
   assert rep != null;

   for (int i = 0; i < options.length; ++i)
   {
      if (options[i][0].equalsIgnoreCase(OPT_SOURCE_ROOT))
      {
         if (s_TargetRootDirectory == null)
            s_TargetRootDirectory = options[i][1];
         else
            s_Logger.warn("Ignoring additional definition of '" + options[i][0] + "' with argument '"
               + options[i][1] + "'");
      }
   }

   if (s_TargetRootDirectory == null)
   {
      s_Logger.fatal("Source root directory required (-evf_sourceroot <dir>)");
      return false;
   }
   else
   {
      return true;
   }
}
项目:pbase    文件:StabilityOptions.java   
public static void validOptions(String[][] options, DocErrorReporter reporter) {
  for (int i = 0; i < options.length; i++) {
    String opt = options[i][0].toLowerCase();
    if (opt.equals(UNSTABLE_OPTION)) {
      RootDocProcessor.stability = UNSTABLE_OPTION;
    } else if (opt.equals(EVOLVING_OPTION)) {
      RootDocProcessor.stability = EVOLVING_OPTION;
    } else if (opt.equals(STABLE_OPTION)) {
      RootDocProcessor.stability = STABLE_OPTION;
    }
  }
}
项目:hops    文件:StabilityOptions.java   
public static void validOptions(String[][] options,
    DocErrorReporter reporter) {
  for (int i = 0; i < options.length; i++) {
    String opt = options[i][0].toLowerCase(Locale.ENGLISH);
    if (opt.equals(UNSTABLE_OPTION)) {
      RootDocProcessor.stability = UNSTABLE_OPTION;
    } else if (opt.equals(EVOLVING_OPTION)) {
      RootDocProcessor.stability = EVOLVING_OPTION;
    } else if (opt.equals(STABLE_OPTION)) {
      RootDocProcessor.stability = STABLE_OPTION;
    }
  }
}
项目:markdoclet    文件:Markdoclet.java   
public static boolean validOptions(String[][] options, DocErrorReporter reporter) {
    final Set<String> supportedOptions = new HashSet<>(asList(OPTION_OUTPUT, OPTION_PROPERTIES, OPTION_TITLE));
    final Set<String> optionsFound = new HashSet<>();
    boolean valid = true;
    for (String[] option : options) {
        final String name = option[0];
        if (supportedOptions.contains(name)) {
            if (optionsFound.contains(name)) {
                reporter.printError("Only one " + name + " option allowed.");
                valid = false;
            }
            optionsFound.add(name);
            final String value = option[1];
            if (name.equals(OPTION_OUTPUT)) {
                valid = valid && verifyOutputFile(value, reporter);
            } else if (name.equals(OPTION_PROPERTIES)) {
                valid = valid && verifyPropertiesFile(value, reporter);
            } else if (name.equals(OPTION_TITLE)) {
                valid = valid && verifyTitle(value);
            }
        }
    }
    if (!optionsFound.contains(OPTION_OUTPUT)) {
        reporter.printError("Missing required property -output");
        return false;
    }
    return valid;
}
项目:markdoclet    文件:Markdoclet.java   
private static boolean verifyOutputFile(String filename, DocErrorReporter reporter) {
    final File file = new File(filename);
    if (file.exists() && file.isDirectory()) {
        reporter.printError("Output file " + filename + " is a directory.");
        return false;
    }
    if (file.exists() && !file.canWrite()) {
        reporter.printError("Output file " + filename + " exists and cannot be overwritten.");
        return false;
    }
    outputFile = file;
    return true;
}
项目:markdoclet    文件:Markdoclet.java   
private static boolean verifyPropertiesFile(String propertiesFile, DocErrorReporter reporter) {
    try (FileReader fileReader = new FileReader(propertiesFile);
         BufferedReader reader = new BufferedReader(fileReader)) {
        properties = new Properties();
        properties.load(reader);
    } catch (IOException e) {
        reporter.printError("Couldn't load properties from " + propertiesFile);
        return false;
    }
    return true;
}
项目:hadoop-TCP    文件:StabilityOptions.java   
public static void validOptions(String[][] options,
     DocErrorReporter reporter) {
   for (int i = 0; i < options.length; i++) {
     String opt = options[i][0].toLowerCase();
     if (opt.equals(UNSTABLE_OPTION)) {
RootDocProcessor.stability = UNSTABLE_OPTION;
     } else if (opt.equals(EVOLVING_OPTION)) {
RootDocProcessor.stability = EVOLVING_OPTION;
     } else if (opt.equals(STABLE_OPTION)) {
RootDocProcessor.stability = STABLE_OPTION; 
     }
   }
 }
项目:wso2-axis2-transports    文件:ResourceInfoDoclet.java   
public static boolean validOptions(String options[][], DocErrorReporter reporter) {
    boolean hasOut = false;
    for (String[] option : options) {
        String opt = option[0];
        if (opt.equals("-out")) {
            hasOut = true;
        }
    }
    if (!hasOut) {
        reporter.printError("No output file specified: -out <output file>");
        return false;
    } else {
        return true;
    }
}
项目:JamVM-PH    文件:HtmlRepairer.java   
public HtmlRepairer(DocErrorReporter warningReporter, 
      boolean noWarn, boolean noEmailWarn,
      ClassDoc contextClass, MemberDoc contextMember,
                    boolean throwAwayLeadingPara) {
   this.warningReporter = warningReporter;
   this.noWarn = noWarn;
   this.noEmailWarn = noEmailWarn;
   this.contextClass = contextClass;
   this.contextMember = contextMember;
   this.throwAwayLeadingPara = throwAwayLeadingPara;
}
项目:docdown    文件:DocdownOption.java   
/**
 * Parse command line options.
 *
 * @param options command line options to parse
 * @param reporter error reporter
 * @return true if options are valid.
 */
public boolean parseOptions(String[][] options, DocErrorReporter reporter) {
    boolean valid = true;
    for (String[] option : options) {
        switch (option[0].toLowerCase()) {
            case "-t" :
                valid = setTitle(option[1], reporter);
                break;
            case "-d":
                valid = setOutputDir(option[1], reporter);
                break;
            case "-docsourcepath":
                valid = setDocSourcePaths(option[1], reporter);
                break;
            case "-includepath":
                valid = setIncludeCodePaths(option[1], reporter);
                break;
            case "-link":
                valid = addLinkProvider(option[1], reporter);
                break;
            case "-linkoffline":
                valid = addLinkProvider(option[1], option[2], reporter);
                break;
        }
        if (!valid) {
            return false;
        }
    }
    if (outputDir == null) {
        reporter.printError("Output directory not defined.");
        return false;
    }
    if (projectDocSrcDirs == null) {
        reporter.printError("Project documentation source directories not defined.");
        return false;
    }
    return true;
}
项目:docdown    文件:DocdownOption.java   
private boolean setOutputDir(String outputDirName, DocErrorReporter reporter) {
    outputDir = Paths.get(outputDirName);
    if (Files.exists(outputDir)) {
        return Files.isDirectory(outputDir);
    } else {
        try {
            Files.createDirectories(outputDir);
        } catch (IOException e) {
            reporter.printError("Error creating output directory " + outputDirName + ". " + e.getMessage());
            return false;
        }
    }
    return true;
}
项目:docdown    文件:DocdownOption.java   
private boolean setDocSourcePaths(String paths, DocErrorReporter reporter) {
    projectDocSrcDirs = new ArrayList<>();
    for (String path : paths.split(File.pathSeparator)) {
        projectDocSrcDirs.add(Paths.get(path));
    }
    return projectDocSrcDirs.size() > 0;
}
项目:docdown    文件:DocdownOption.java   
private boolean setIncludeCodePaths(String paths, DocErrorReporter reporter) {
    includeCodeDirs = new ArrayList<>();
    for (String path : paths.split(File.pathSeparator)) {
        includeCodeDirs.add(Paths.get(paths));
    }
    return includeCodeDirs.size() > 0;
}
项目:docdown    文件:DocdownOption.java   
private boolean addLinkProvider(String url, DocErrorReporter reporter) {
    try {
        externalRefProviders.add(new ExternalRefProvider(url));
        return true;
    } catch (IOException e) {
        reporter.printWarning("Unable to load link for " + url + ". " + e.getMessage());
        return false;
    }
}
项目:docdown    文件:DocdownOption.java   
private boolean addLinkProvider(String url, String packageListUrl, DocErrorReporter reporter) {
    try {
        externalRefProviders.add(new ExternalRefProvider(url, packageListUrl));
        return true;
    } catch (IOException e) {
        reporter.printWarning("Unable to load linksoffline for " + packageListUrl + ". " + e.getMessage());
        return false;
    }
}
项目:hardfs    文件:StabilityOptions.java   
public static void validOptions(String[][] options,
     DocErrorReporter reporter) {
   for (int i = 0; i < options.length; i++) {
     String opt = options[i][0].toLowerCase();
     if (opt.equals(UNSTABLE_OPTION)) {
RootDocProcessor.stability = UNSTABLE_OPTION;
     } else if (opt.equals(EVOLVING_OPTION)) {
RootDocProcessor.stability = EVOLVING_OPTION;
     } else if (opt.equals(STABLE_OPTION)) {
RootDocProcessor.stability = STABLE_OPTION; 
     }
   }
 }
项目:hadoop-on-lustre2    文件:StabilityOptions.java   
public static void validOptions(String[][] options,
     DocErrorReporter reporter) {
   for (int i = 0; i < options.length; i++) {
     String opt = options[i][0].toLowerCase();
     if (opt.equals(UNSTABLE_OPTION)) {
RootDocProcessor.stability = UNSTABLE_OPTION;
     } else if (opt.equals(EVOLVING_OPTION)) {
RootDocProcessor.stability = EVOLVING_OPTION;
     } else if (opt.equals(STABLE_OPTION)) {
RootDocProcessor.stability = STABLE_OPTION; 
     }
   }
 }
项目:doclava    文件:Doclava.java   
public static boolean validOptions(String[][] options, DocErrorReporter r) {
  for (String[] a : options) {
    if (a[0].equals("-error") || a[0].equals("-warning") || a[0].equals("-hide")) {
      try {
        Integer.parseInt(a[1]);
      } catch (NumberFormatException e) {
        r.printError("bad -" + a[0] + " value must be a number: " + a[1]);
        return false;
      }
    }
  }

  return true;
}