本文整理匯總了Java中com.sun.javadoc.DocErrorReporter.printError方法的典型用法代碼示例。如果您正苦於以下問題:Java DocErrorReporter.printError方法的具體用法?Java DocErrorReporter.printError怎麽用?Java DocErrorReporter.printError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.javadoc.DocErrorReporter
的用法示例。
在下文中一共展示了DocErrorReporter.printError方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validOptions
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
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;
}
示例2: checkOptions
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
/**
* 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;
}
示例3: validOptions
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
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;
}
示例4: validOptions
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
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;
}
示例5: validOptions
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
/**
* 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;
}
示例6: validOptions
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
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;
}
示例7: verifyOutputFile
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
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;
}
示例8: verifyPropertiesFile
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
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;
}
示例9: validOptions
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
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;
}
}
示例10: parseOptions
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
/**
* 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;
}
示例11: setOutputDir
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
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;
}
示例12: validOptions
import com.sun.javadoc.DocErrorReporter; //導入方法依賴的package包/類
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;
}