1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.hadoop.hbase.classification.tools;
19
20 import org.apache.hadoop.hbase.classification.InterfaceAudience;
21
22 import com.sun.javadoc.DocErrorReporter;
23 import com.sun.javadoc.LanguageVersion;
24 import com.sun.javadoc.RootDoc;
25 import com.sun.tools.doclets.standard.Standard;
26
27 /**
28 * A <a href="http://java.sun.com/javase/6/docs/jdk/api/javadoc/doclet/">Doclet</a>
29 * that only includes class-level elements that are annotated with
30 * {@link org.apache.hadoop.hbase.classification.InterfaceAudience.Public}.
31 * Class-level elements with no annotation are excluded.
32 * In addition, all elements that are annotated with
33 * {@link org.apache.hadoop.hbase.classification.InterfaceAudience.Private} or
34 * {@link org.apache.hadoop.hbase.classification.InterfaceAudience.LimitedPrivate}
35 * are also excluded.
36 * It delegates to the Standard Doclet, and takes the same options.
37 */
38 @InterfaceAudience.Private
39 public class IncludePublicAnnotationsStandardDoclet {
40
41 public static LanguageVersion languageVersion() {
42 return LanguageVersion.JAVA_1_5;
43 }
44
45 public static boolean start(RootDoc root) {
46 System.out.println(
47 IncludePublicAnnotationsStandardDoclet.class.getSimpleName());
48 RootDocProcessor.treatUnannotatedClassesAsPrivate = true;
49 return Standard.start(RootDocProcessor.process(root));
50 }
51
52 public static int optionLength(String option) {
53 Integer length = StabilityOptions.optionLength(option);
54 if (length != null) {
55 return length;
56 }
57 return Standard.optionLength(option);
58 }
59
60 public static boolean validOptions(String[][] options,
61 DocErrorReporter reporter) {
62 StabilityOptions.validOptions(options, reporter);
63 String[][] filteredOptions = StabilityOptions.filterOptions(options);
64 return Standard.validOptions(filteredOptions, reporter);
65 }
66 }