* Start parsing using the standard HTML doclet
* @param root the root of the document tree
* @return true if the parsing is successful, or false if there is an error
*/
public static boolean start(RootDoc root) {
HtmlDoclet doclet = new HtmlDoclet();
// get the APIs from the arguments
String[][] options = root.options();
String[] types = null;
for (String[] option : options) {
if (option[0].toLowerCase().equals("-wonderlandapi")) {
types = option[1].split(",");
// convert to internal names
for (int i = 0; i < types.length; i++) {
types[i] = API_MAP.get(types[i].toLowerCase());
}
}
}
try {
// wrap the root object
ClassLoader loader = WonderlandDoclet.class.getClassLoader();
Class<?>[] interfaces = new Class<?>[] { RootDoc.class };
RootDocWrapper handler = new RootDocWrapper(root, types);
RootDoc wrapper =
(RootDoc) Proxy.newProxyInstance(loader, interfaces, handler);
// overwrite the configuration used by the standard doclet to
// return our wrapped classes
doclet.configuration.root = wrapper;
doclet.configuration.packages = handler.wrappedPackages;
// parse using the standard HTML doclet
doclet.start(doclet, wrapper);
} catch (Exception exc) {
exc.printStackTrace();
return false;
}
return true;