src/share/classes/com/sun/tools/javadoc/Main.java

changeset 0
959103a6100f
child 2525
2eb010b6cb22
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javadoc/Main.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,193 @@
     1.4 +/*
     1.5 + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.tools.javadoc;
    1.30 +
    1.31 +import java.io.PrintWriter;
    1.32 +
    1.33 +/**
    1.34 + * Provides external entry points (tool and programmatic)
    1.35 + * for the javadoc program.
    1.36 + *
    1.37 + *  <p><b>This is NOT part of any supported API.
    1.38 + *  If you write code that depends on this, you do so at your own risk.
    1.39 + *  This code and its internal interfaces are subject to change or
    1.40 + *  deletion without notice.</b>
    1.41 + *
    1.42 + * @since 1.4
    1.43 + */
    1.44 +public class Main {
    1.45 +
    1.46 +    /**
    1.47 +     * Constructor should never be called.
    1.48 +     */
    1.49 +    private Main() {
    1.50 +    }
    1.51 +
    1.52 +    /**
    1.53 +     * Command line interface.
    1.54 +     * @param args   The command line parameters.
    1.55 +     */
    1.56 +    public static void main(String... args) {
    1.57 +        System.exit(execute(args));
    1.58 +    }
    1.59 +
    1.60 +    /**
    1.61 +     * Programmatic interface.
    1.62 +     * @param args   The command line parameters.
    1.63 +     * @return The return code.
    1.64 +     */
    1.65 +    public static int execute(String... args) {
    1.66 +        Start jdoc = new Start();
    1.67 +        return jdoc.begin(args);
    1.68 +    }
    1.69 +
    1.70 +    /**
    1.71 +     * Programmatic interface.
    1.72 +     * @param args   The command line parameters.
    1.73 +     * @param docletParentClassLoader The parent class loader used when
    1.74 +     *  creating the doclet classloader. If null, the class loader used
    1.75 +     *  to instantiate doclets will be created without specifying a parent
    1.76 +     *  class loader.
    1.77 +     * @return The return code.
    1.78 +     * @since 1.7
    1.79 +     */
    1.80 +    public static int execute(ClassLoader docletParentClassLoader, String... args) {
    1.81 +        Start jdoc = new Start(docletParentClassLoader);
    1.82 +        return jdoc.begin(args);
    1.83 +    }
    1.84 +
    1.85 +    /**
    1.86 +     * Programmatic interface.
    1.87 +     * @param programName  Name of the program (for error messages).
    1.88 +     * @param args   The command line parameters.
    1.89 +     * @return The return code.
    1.90 +     */
    1.91 +    public static int execute(String programName, String... args) {
    1.92 +        Start jdoc = new Start(programName);
    1.93 +        return jdoc.begin(args);
    1.94 +    }
    1.95 +
    1.96 +    /**
    1.97 +     * Programmatic interface.
    1.98 +     * @param programName  Name of the program (for error messages).
    1.99 +     * @param args   The command line parameters.
   1.100 +     * @param docletParentClassLoader The parent class loader used when
   1.101 +     *  creating the doclet classloader. If null, the class loader used
   1.102 +     *  to instantiate doclets will be created without specifying a parent
   1.103 +     *  class loader.
   1.104 +     * @return The return code.
   1.105 +     * @since 1.7
   1.106 +     */
   1.107 +    public static int execute(String programName, ClassLoader docletParentClassLoader, String... args) {
   1.108 +        Start jdoc = new Start(programName, docletParentClassLoader);
   1.109 +        return jdoc.begin(args);
   1.110 +    }
   1.111 +
   1.112 +    /**
   1.113 +     * Programmatic interface.
   1.114 +     * @param programName  Name of the program (for error messages).
   1.115 +     * @param defaultDocletClassName  Fully qualified class name.
   1.116 +     * @param args   The command line parameters.
   1.117 +     * @return The return code.
   1.118 +     */
   1.119 +    public static int execute(String programName,
   1.120 +                              String defaultDocletClassName,
   1.121 +                              String... args) {
   1.122 +        Start jdoc = new Start(programName, defaultDocletClassName);
   1.123 +        return jdoc.begin(args);
   1.124 +    }
   1.125 +
   1.126 +    /**
   1.127 +     * Programmatic interface.
   1.128 +     * @param programName  Name of the program (for error messages).
   1.129 +     * @param defaultDocletClassName  Fully qualified class name.
   1.130 +     * @param docletParentClassLoader The parent class loader used when
   1.131 +     *  creating the doclet classloader. If null, the class loader used
   1.132 +     *  to instantiate doclets will be created without specifying a parent
   1.133 +     *  class loader.
   1.134 +     * @param args   The command line parameters.
   1.135 +     * @return The return code.
   1.136 +     * @since 1.7
   1.137 +     */
   1.138 +    public static int execute(String programName,
   1.139 +                              String defaultDocletClassName,
   1.140 +                              ClassLoader docletParentClassLoader,
   1.141 +                              String... args) {
   1.142 +        Start jdoc = new Start(programName, defaultDocletClassName, docletParentClassLoader);
   1.143 +        return jdoc.begin(args);
   1.144 +    }
   1.145 +
   1.146 +    /**
   1.147 +     * Programmatic interface.
   1.148 +     * @param programName  Name of the program (for error messages).
   1.149 +     * @param errWriter    PrintWriter to receive error messages.
   1.150 +     * @param warnWriter    PrintWriter to receive error messages.
   1.151 +     * @param noticeWriter    PrintWriter to receive error messages.
   1.152 +     * @param defaultDocletClassName  Fully qualified class name.
   1.153 +     * @param args   The command line parameters.
   1.154 +     * @return The return code.
   1.155 +     */
   1.156 +    public static int execute(String programName,
   1.157 +                              PrintWriter errWriter,
   1.158 +                              PrintWriter warnWriter,
   1.159 +                              PrintWriter noticeWriter,
   1.160 +                              String defaultDocletClassName,
   1.161 +                              String... args) {
   1.162 +        Start jdoc = new Start(programName,
   1.163 +                               errWriter, warnWriter, noticeWriter,
   1.164 +                               defaultDocletClassName);
   1.165 +        return jdoc.begin(args);
   1.166 +    }
   1.167 +
   1.168 +    /**
   1.169 +     * Programmatic interface.
   1.170 +     * @param programName  Name of the program (for error messages).
   1.171 +     * @param errWriter    PrintWriter to receive error messages.
   1.172 +     * @param warnWriter    PrintWriter to receive error messages.
   1.173 +     * @param noticeWriter    PrintWriter to receive error messages.
   1.174 +     * @param defaultDocletClassName  Fully qualified class name.
   1.175 +     * @param docletParentClassLoader The parent class loader used when
   1.176 +     *  creating the doclet classloader. If null, the class loader used
   1.177 +     *  to instantiate doclets will be created without specifying a parent
   1.178 +     *  class loader.
   1.179 +     * @param args   The command line parameters.
   1.180 +     * @return The return code.
   1.181 +     * @since 1.7
   1.182 +     */
   1.183 +    public static int execute(String programName,
   1.184 +                              PrintWriter errWriter,
   1.185 +                              PrintWriter warnWriter,
   1.186 +                              PrintWriter noticeWriter,
   1.187 +                              String defaultDocletClassName,
   1.188 +                              ClassLoader docletParentClassLoader,
   1.189 +                              String... args) {
   1.190 +        Start jdoc = new Start(programName,
   1.191 +                               errWriter, warnWriter, noticeWriter,
   1.192 +                               defaultDocletClassName,
   1.193 +                               docletParentClassLoader);
   1.194 +        return jdoc.begin(args);
   1.195 +    }
   1.196 +}

mercurial