HBASE-17563 Changed for-loops and switch-statements in RootDocProcessor and StabilityOptions
Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
parent
3693d1306d
commit
87e1ba9a1a
|
@ -107,43 +107,46 @@ final class RootDocProcessor {
|
|||
return !exclude(doc) && doc.isIncluded();
|
||||
}
|
||||
if (target instanceof RootDoc) {
|
||||
if (methodName.equals("classes")) {
|
||||
switch (methodName) {
|
||||
case "classes":
|
||||
return filter(((RootDoc) target).classes(), ClassDoc.class);
|
||||
} else if (methodName.equals("specifiedClasses")) {
|
||||
case "specifiedClasses":
|
||||
return filter(((RootDoc) target).specifiedClasses(), ClassDoc.class);
|
||||
} else if (methodName.equals("specifiedPackages")) {
|
||||
case "specifiedPackages":
|
||||
return filter(((RootDoc) target).specifiedPackages(), PackageDoc.class);
|
||||
}
|
||||
} else if (target instanceof ClassDoc) {
|
||||
if (isFiltered(args)) {
|
||||
if (methodName.equals("methods")) {
|
||||
switch (methodName) {
|
||||
case "methods":
|
||||
return filter(((ClassDoc) target).methods(true), MethodDoc.class);
|
||||
} else if (methodName.equals("fields")) {
|
||||
case "fields":
|
||||
return filter(((ClassDoc) target).fields(true), FieldDoc.class);
|
||||
} else if (methodName.equals("innerClasses")) {
|
||||
case "innerClasses":
|
||||
return filter(((ClassDoc) target).innerClasses(true), ClassDoc.class);
|
||||
} else if (methodName.equals("constructors")) {
|
||||
case "constructors":
|
||||
return filter(((ClassDoc) target).constructors(true), ConstructorDoc.class);
|
||||
}
|
||||
}
|
||||
} else if (target instanceof PackageDoc) {
|
||||
if (methodName.equals("allClasses")) {
|
||||
switch (methodName) {
|
||||
case "allClasses":
|
||||
if (isFiltered(args)) {
|
||||
return filter(((PackageDoc) target).allClasses(true), ClassDoc.class);
|
||||
} else {
|
||||
return filter(((PackageDoc) target).allClasses(), ClassDoc.class);
|
||||
}
|
||||
} else if (methodName.equals("annotationTypes")) {
|
||||
case "annotationTypes":
|
||||
return filter(((PackageDoc) target).annotationTypes(), AnnotationTypeDoc.class);
|
||||
} else if (methodName.equals("enums")) {
|
||||
case "enums":
|
||||
return filter(((PackageDoc) target).enums(), ClassDoc.class);
|
||||
} else if (methodName.equals("errors")) {
|
||||
case "errors":
|
||||
return filter(((PackageDoc) target).errors(), ClassDoc.class);
|
||||
} else if (methodName.equals("exceptions")) {
|
||||
case "exceptions":
|
||||
return filter(((PackageDoc) target).exceptions(), ClassDoc.class);
|
||||
} else if (methodName.equals("interfaces")) {
|
||||
case "interfaces":
|
||||
return filter(((PackageDoc) target).interfaces(), ClassDoc.class);
|
||||
} else if (methodName.equals("ordinaryClasses")) {
|
||||
case "ordinaryClasses":
|
||||
return filter(((PackageDoc) target).ordinaryClasses(), ClassDoc.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,25 +40,32 @@ final class StabilityOptions {
|
|||
}
|
||||
|
||||
public static void validOptions(String[][] options, DocErrorReporter reporter) {
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
String opt = options[i][0].toLowerCase(Locale.ROOT);
|
||||
if (opt.equals(UNSTABLE_OPTION)) {
|
||||
for (String[] option : options) {
|
||||
String opt = option[0].toLowerCase(Locale.ROOT);
|
||||
switch (opt) {
|
||||
case UNSTABLE_OPTION:
|
||||
RootDocProcessor.stability = UNSTABLE_OPTION;
|
||||
} else if (opt.equals(EVOLVING_OPTION)) {
|
||||
break;
|
||||
case EVOLVING_OPTION:
|
||||
RootDocProcessor.stability = EVOLVING_OPTION;
|
||||
} else if (opt.equals(STABLE_OPTION)) {
|
||||
break;
|
||||
case STABLE_OPTION:
|
||||
RootDocProcessor.stability = STABLE_OPTION;
|
||||
break;
|
||||
default:
|
||||
RootDocProcessor.stability = UNSTABLE_OPTION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String[][] filterOptions(String[][] options) {
|
||||
List<String[]> optionsList = new ArrayList<>();
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
if (!options[i][0].equalsIgnoreCase(UNSTABLE_OPTION)
|
||||
&& !options[i][0].equalsIgnoreCase(EVOLVING_OPTION)
|
||||
&& !options[i][0].equalsIgnoreCase(STABLE_OPTION)) {
|
||||
optionsList.add(options[i]);
|
||||
for (String[] option : options) {
|
||||
if (!option[0].equalsIgnoreCase(UNSTABLE_OPTION)
|
||||
&& !option[0].equalsIgnoreCase(EVOLVING_OPTION)
|
||||
&& !option[0].equalsIgnoreCase(STABLE_OPTION)) {
|
||||
optionsList.add(option);
|
||||
}
|
||||
}
|
||||
String[][] filteredOptions = new String[optionsList.size()][];
|
||||
|
|
Loading…
Reference in New Issue