View Javadoc

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  import com.sun.javadoc.DocErrorReporter;
22  import com.sun.javadoc.LanguageVersion;
23  import com.sun.javadoc.RootDoc;
24  import com.sun.tools.doclets.standard.Standard;
25  
26  /**
27   * A <a href="http://java.sun.com/javase/6/docs/jdk/api/javadoc/doclet/">Doclet</a>
28   * for excluding elements that are annotated with
29   * {@link org.apache.hadoop.hbase.classification.InterfaceAudience.Private} or
30   * {@link org.apache.hadoop.hbase.classification.InterfaceAudience.LimitedPrivate}.
31   * It delegates to the Standard Doclet, and takes the same options.
32   */
33  @InterfaceAudience.Private
34  public class ExcludePrivateAnnotationsStandardDoclet {
35  
36    public static LanguageVersion languageVersion() {
37      return LanguageVersion.JAVA_1_5;
38    }
39  
40    public static boolean start(RootDoc root) {
41      System.out.println(
42        ExcludePrivateAnnotationsStandardDoclet.class.getSimpleName());
43      return Standard.start(RootDocProcessor.process(root));
44    }
45  
46    public static int optionLength(String option) {
47      Integer length = StabilityOptions.optionLength(option);
48      if (length != null) {
49        return length;
50      }
51      return Standard.optionLength(option);
52    }
53  
54    public static boolean validOptions(String[][] options,
55        DocErrorReporter reporter) {
56      StabilityOptions.validOptions(options, reporter);
57      String[][] filteredOptions = StabilityOptions.filterOptions(options);
58      return Standard.validOptions(filteredOptions, reporter);
59    }
60  }