mil.dod.th.word.htm.doclet/src/org/udri/doclet/msword/Options.java
public static Options toOptions(String options[][], DocErrorReporter reporter)
    {
        Options o = new Options();

        // Flags
        o.multipleFiles = has(options, "-multiple");

        // Output directory
        if (has(options, "-d"))
        {
            String directory = get(options, "-d");
            if (directory == null)
            {
                reporter.printError("Missing value for <directory>, usage:");
                reporter.printError("-d <directory> Destination directory for output files");
                return null;
            }
            else
            {
                o.directory = new File(directory);
                reporter.printNotice("Output directory: " + directory);
            }
        }
        else
        {
            reporter.printError("Output directory not specified; use -d <directory>");
            return null;
        }

        // Output encoding
        if (has(options, "-docencoding"))
        {
            String encoding = get(options, "-docencoding");
            if (encoding == null)
            {
                reporter.printError("Missing value for <name>, usage:");
                reporter.printError("-docencoding <name> \t Output encoding name");
                return null;
            }
            else
            {
                o.encoding = Charset.forName(encoding);
                reporter.printNotice("Output encoding: " + o.encoding);
            }
        }

        // Extends
        if (has(options, "-outputFile"))
        {
            String name = get(options, "-outputFile");
            if (name != null && !o.multipleFiles)
            {
                o.filename = name;
                reporter.printNotice("Using output file name: " + name);
            }
            else
                reporter.printWarning("'-outputFile' option ignored");
        }
        if (has(options, "-inputFile"))
        {
            String name = get(options, "-inputFile");
            if (name != null && !o.multipleFiles)
            {
                o.inputFile = name;
                reporter.printNotice("Using input file name: " + name);
            }
            else
                reporter.printWarning("'-inputFile' option ignored");
        }
        if (has(options, "-brokenLinksReport"))
        {
            String name = get(options, "-brokenLinksReport");
            if (name != null && !o.multipleFiles)
            {
                o.brokenLinksReportFile = name;
                reporter.printNotice("Using broking links report file name: " + name);
            }
            else
                reporter.printWarning("'-brokenLinksReport' option ignored");
        }
        if (has(options, "-xsdDir"))
        {
            String name = get(options, "-xsdDir");
            if (name != null && !o.multipleFiles)
            {
                o.xsdDir = name;
                reporter.printNotice("Using xsd directory: " + name);
            }
            else
                reporter.printWarning("'-xsdDir' option ignored");
        }

        // Extends
        if (has(options, "-extends"))
        {
            String superclass = get(options, "-extends");
            if (superclass != null)
            {
                o.extendsFilter = superclass;
                reporter.printNotice("Filtering classes extending: " + superclass);
            }
            else
                reporter.printWarning("'-extends' option ignored - superclass not specified");
        }

        // Implements
        if (has(options, "-implements"))
        {
            String iface = get(options, "-implements");
            if (iface != null)
            {
                o.implementsFilter = iface;
                reporter.printNotice("Filtering classes implementing: " + iface);
            }
            else
                reporter.printWarning("'-implements' option ignored - interface not specified");
        }

        // Taglets
        if (has(options, "-taglet"))
        {
            String classes = get(options, "-taglet");
            if (classes != null)
            {
                for (String c : classes.split(":"))
                {
                    try
                    {
                        Class<?> x = Class.forName(c);
                        Class<? extends Taglet> t = x.asSubclass(Taglet.class);
                        Method m = t.getMethod("register", Map.class);
                        m.invoke(null, o.taglets);
                        reporter.printNotice("Using Taglet " + t.getName());
                    }
                    catch (Exception ex)
                    {
                        reporter.printError("'-taglet' option reported error - :" + ex.getMessage());
                    }
                }
            }
            else
                reporter.printWarning("'-taglet' option ignored - classes not specified");
        }

        // If we reached this point everything is OK
        return o;
    }
/**
     * Retrieve the expected options from the given array of options.
     * 
     * 
     * @param options
     *            The two dimensional array of options.
     * @param reporter
     *            The error reporter.
     */
Retrieve the expected options from the given array of options.

@param options
The two dimensional array of options.
@param reporter
The error reporter.
Retrieve the expected options from the given array of options . @param options The two dimensional array of options . @param reporter The error reporter .
public static Options toOptions(String options[][], DocErrorReporter reporter)
    {
        Options o = new Options();
        o.multipleFiles = has(options, "-multiple");
        if (has(options, "-d"))
        {
            String directory = get(options, "-d");
            if (directory == null)
            {
                reporter.printError("Missing value for <directory>, usage:");
                reporter.printError("-d <directory> Destination directory for output files");
                return null;
            }
            else
            {
                o.directory = new File(directory);
                reporter.printNotice("Output directory: " + directory);
            }
        }
        else
        {
            reporter.printError("Output directory not specified; use -d <directory>");
            return null;
        }
        if (has(options, "-docencoding"))
        {
            String encoding = get(options, "-docencoding");
            if (encoding == null)
            {
                reporter.printError("Missing value for <name>, usage:");
                reporter.printError("-docencoding <name> \t Output encoding name");
                return null;
            }
            else
            {
                o.encoding = Charset.forName(encoding);
                reporter.printNotice("Output encoding: " + o.encoding);
            }
        }
        if (has(options, "-outputFile"))
        {
            String name = get(options, "-outputFile");
            if (name != null && !o.multipleFiles)
            {
                o.filename = name;
                reporter.printNotice("Using output file name: " + name);
            }
            else
                reporter.printWarning("'-outputFile' option ignored");
        }
        if (has(options, "-inputFile"))
        {
            String name = get(options, "-inputFile");
            if (name != null && !o.multipleFiles)
            {
                o.inputFile = name;
                reporter.printNotice("Using input file name: " + name);
            }
            else
                reporter.printWarning("'-inputFile' option ignored");
        }
        if (has(options, "-brokenLinksReport"))
        {
            String name = get(options, "-brokenLinksReport");
            if (name != null && !o.multipleFiles)
            {
                o.brokenLinksReportFile = name;
                reporter.printNotice("Using broking links report file name: " + name);
            }
            else
                reporter.printWarning("'-brokenLinksReport' option ignored");
        }
        if (has(options, "-xsdDir"))
        {
            String name = get(options, "-xsdDir");
            if (name != null && !o.multipleFiles)
            {
                o.xsdDir = name;
                reporter.printNotice("Using xsd directory: " + name);
            }
            else
                reporter.printWarning("'-xsdDir' option ignored");
        }
        if (has(options, "-extends"))
        {
            String superclass = get(options, "-extends");
            if (superclass != null)
            {
                o.extendsFilter = superclass;
                reporter.printNotice("Filtering classes extending: " + superclass);
            }
            else
                reporter.printWarning("'-extends' option ignored - superclass not specified");
        }
        if (has(options, "-implements"))
        {
            String iface = get(options, "-implements");
            if (iface != null)
            {
                o.implementsFilter = iface;
                reporter.printNotice("Filtering classes implementing: " + iface);
            }
            else
                reporter.printWarning("'-implements' option ignored - interface not specified");
        }
        if (has(options, "-taglet"))
        {
            String classes = get(options, "-taglet");
            if (classes != null)
            {
                for (String c : classes.split(":"))
                {
                    try
                    {
                        Class<?> x = Class.forName(c);
                        Class<? extends Taglet> t = x.asSubclass(Taglet.class);
                        Method m = t.getMethod("register", Map.class);
                        m.invoke(null, o.taglets);
                        reporter.printNotice("Using Taglet " + t.getName());
                    }
                    catch (Exception ex)
                    {
                        reporter.printError("'-taglet' option reported error - :" + ex.getMessage());
                    }
                }
            }
            else
                reporter.printWarning("'-taglet' option ignored - classes not specified");
        }
        return o;
    }
public static Options toOptions ( String options [ ] [ ] , DocErrorReporter reporter ) { Options o = new Options ( ) ; o . multipleFiles = has ( options , "-multiple" ) ; if ( has ( options , "-d" ) ) { String directory = get ( options , "-d" ) ; if ( directory == null ) { reporter . printError ( "Missing value for <directory>, usage:" ) ; reporter . printError ( "-d <directory> Destination directory for output files" ) ; return null ; } else { o . directory = new File ( directory ) ; reporter . printNotice ( "Output directory: " + directory ) ; } } else { reporter . printError ( "Output directory not specified; use -d <directory>" ) ; return null ; } if ( has ( options , "-docencoding" ) ) { String encoding = get ( options , "-docencoding" ) ; if ( encoding == null ) { reporter . printError ( "Missing value for <name>, usage:" ) ; reporter . printError ( "-docencoding <name> \t Output encoding name" ) ; return null ; } else { o . encoding = Charset . forName ( encoding ) ; reporter . printNotice ( "Output encoding: " + o . encoding ) ; } } if ( has ( options , "-outputFile" ) ) { String name = get ( options , "-outputFile" ) ; if ( name != null && ! o . multipleFiles ) { o . filename = name ; reporter . printNotice ( "Using output file name: " + name ) ; } else reporter . printWarning ( "'-outputFile' option ignored" ) ; } if ( has ( options , "-inputFile" ) ) { String name = get ( options , "-inputFile" ) ; if ( name != null && ! o . multipleFiles ) { o . inputFile = name ; reporter . printNotice ( "Using input file name: " + name ) ; } else reporter . printWarning ( "'-inputFile' option ignored" ) ; } if ( has ( options , "-brokenLinksReport" ) ) { String name = get ( options , "-brokenLinksReport" ) ; if ( name != null && ! o . multipleFiles ) { o . brokenLinksReportFile = name ; reporter . printNotice ( "Using broking links report file name: " + name ) ; } else reporter . printWarning ( "'-brokenLinksReport' option ignored" ) ; } if ( has ( options , "-xsdDir" ) ) { String name = get ( options , "-xsdDir" ) ; if ( name != null && ! o . multipleFiles ) { o . xsdDir = name ; reporter . printNotice ( "Using xsd directory: " + name ) ; } else reporter . printWarning ( "'-xsdDir' option ignored" ) ; } if ( has ( options , "-extends" ) ) { String superclass = get ( options , "-extends" ) ; if ( superclass != null ) { o . extendsFilter = superclass ; reporter . printNotice ( "Filtering classes extending: " + superclass ) ; } else reporter . printWarning ( "'-extends' option ignored - superclass not specified" ) ; } if ( has ( options , "-implements" ) ) { String iface = get ( options , "-implements" ) ; if ( iface != null ) { o . implementsFilter = iface ; reporter . printNotice ( "Filtering classes implementing: " + iface ) ; } else reporter . printWarning ( "'-implements' option ignored - interface not specified" ) ; } if ( has ( options , "-taglet" ) ) { String classes = get ( options , "-taglet" ) ; if ( classes != null ) { for ( String c : classes . split ( ":" ) ) { try { Class < ? > x = Class . forName ( c ) ; Class < ? extends Taglet > t = x . asSubclass ( Taglet . class ) ; Method m = t . getMethod ( "register" , Map . class ) ; m . invoke ( null , o . taglets ) ; reporter . printNotice ( "Using Taglet " + t . getName ( ) ) ; } catch ( Exception ex ) { reporter . printError ( "'-taglet' option reported error - :" + ex . getMessage ( ) ) ; } } } else reporter . printWarning ( "'-taglet' option ignored - classes not specified" ) ; } return o ; }
Retrieve the expected options from the given array of options.
Retrieve the expected options from the given array of options .
// Flags // Output directory // Output encoding // Extends // Extends // Implements // Taglets // If we reached this point everything is OK