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  
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   * for excluding elements that are annotated with
30   * {@link org.apache.hadoop.hbase.classification.InterfaceAudience.Private} or
31   * {@link org.apache.hadoop.hbase.classification.InterfaceAudience.LimitedPrivate}.
32   * It delegates to the Standard Doclet, and takes the same options.
33   */
34  @InterfaceAudience.Private
35  public class ExcludePrivateAnnotationsStandardDoclet {
36  
37    public static LanguageVersion languageVersion() {
38      return LanguageVersion.JAVA_1_5;
39    }
40  
41    public static boolean start(RootDoc root) {
42      System.out.println(
43  	ExcludePrivateAnnotationsStandardDoclet.class.getSimpleName());
44      return Standard.start(RootDocProcessor.process(root));
45    }
46  
47    public static int optionLength(String option) {
48      Integer length = StabilityOptions.optionLength(option);
49      if (length != null) {
50        return length;
51      }
52      return Standard.optionLength(option);
53    }
54  
55    public static boolean validOptions(String[][] options,
56        DocErrorReporter reporter) {
57      StabilityOptions.validOptions(options, reporter);
58      String[][] filteredOptions = StabilityOptions.filterOptions(options);
59      return Standard.validOptions(filteredOptions, reporter);
60    }
61  }