Java Code Examples for com.sun.tools.doclets.formats.html.HtmlDoclet

Following code examples demonstrate how to use com.sun.tools.doclets.formats.html.HtmlDocletfrom java. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.sun.tools.doclets.formats.html.HtmlDocletand various code implementation of this class.

    public static int optionLength(final String option) {
        if (SampleConfConfiguration.OPTIONS_OUTPUT_FILE.equals(option)) {
            return 2;
        }
        if (SampleConfConfiguration.OPTIONS_EXCLUDE_PROP_WITH_UNDEFINED_DEFAULTS.equals(option)
                || SampleConfConfiguration.OPTIONS_INCLUDE_SECTION_IN_KEY_NAME.equals(option)) {
            return 1;
        }
        return HtmlDoclet.optionLength(option);
    } 


    public static boolean start(RootDoc root) {
        Class clz = root.getClass();
        return HtmlDoclet.start((RootDoc) Proxy.newProxyInstance(clz.getClassLoader(), clz.getInterfaces(), new ExcludeHandler(root)));
    } 

    }

    public static boolean validOptions (String[][] options, DocErrorReporter reporter)
    {
        return HtmlDoclet.validOptions(options, reporter);
    } 

    }

    public static LanguageVersion languageVersion ()
    {
        return HtmlDoclet.languageVersion();
    } 

  public static int optionLength(final String option) {
    if ("-matchingjaxbnamesonly".equals(option)
        || "-jsonconvention".equals(option)) {
      return 2;
    }
    if ("-disablejaxbmethodoutput".equals(option)
        || "-disablejsontypename".equals(option)
        || "-disablexmlexample".equals(option)
        || "-disablejsonexample".equals(option)) {
      return 1;
    }
    return HtmlDoclet.optionLength(option);
  } 

  public static boolean validOptions(final String[][] options, final DocErrorReporter reporter) {
    if (!HtmlDoclet.validOptions(options, reporter)) {
      return false;
    }
    String value = Utils.getOption(options, "-matchingjaxbnamesonly");
    try {
      if(value != null)
        Pattern.compile(value);
    } catch (Throwable t) {
      reporter.printError("Invalid pattern for '-matchingjaxbnamesonly' option: '"+value+"' (not a valid regex)");
      return false;
    }

    String jsonConvention = Utils.getOption(options, "-jsonconvention");
    if(jsonConvention != null 
        && !jsonConvention.equals("mapped")
        && !jsonConvention.equals("jettison")
        && !jsonConvention.equals("badgerfish")){
      reporter.printError("Unknown JSON convention: "+jsonConvention+" (must be one of 'jettison' (default), 'badgerfish', 'mapped')");
      return false;
    }
    return true;
  } 

    public static boolean start(RootDoc root) {
        try {
            doclet = new HtmlDoclet();
            
            doclet.configuration.root = root;
            doclet.configuration.setOptions();
            
            instance().configureCustomTaglets();
            return doclet.start(doclet, root);
        } finally {
            ConfigurationImpl.reset();
            instance.closeTaglets();
        }
    } 

    public static boolean start(RootDoc root) {
        HtmlDoclet doclet = new HtmlJmlDoclet();
        return doclet.start(doclet, root);
    } 

    }

    public static boolean validOptions(String options[][],
                                       DocErrorReporter reporter) {
        return HtmlDoclet.validOptions(options, reporter);
    } 

  public static boolean validOptions(final String[][] options, final DocErrorReporter reporter) {
    if (!HtmlDoclet.validOptions(options, reporter)) {
      return false;
    }
    return true;
  } 

    public int optionLength(final String option) {

        if (JavaDocOption.HELP.getOption().equals(option)) {

            final int toReturn = HtmlDoclet.optionLength(option);

            System.out.println();
            System.out.println("Provided by " + VisualizationDoclet.class.getName() + ":");
            for (JavaDocOption current : JavaDocOption.values()) {
                if (current != JavaDocOption.HELP) {
                    System.out.println(current.getOption() + " " + current.getHelpText());
                }
            }

            return toReturn;
        }

        for (JavaDocOption current : JavaDocOption.values()) {
            if (current.getOption().equals(option)) {
                return current.getOptionLength();
            }
        }

        return HtmlDoclet.optionLength(option);
    } 

    public boolean validateJavaDocOptions(final String[][] options, final DocErrorReporter errorReporter) {

        try {
            htmlDoclet.sharedInstanceForOptions.setOptions(options);
        } catch (Configuration.Fault fault) {
            fault.printStackTrace();
        }

        return HtmlDoclet.validOptions(options, errorReporter);
    } 

    public boolean start(final RootDoc root) {

        if (this.dotFacade == null) {
            throw new IllegalStateException("The DotFacade cannot be null.");
        }

        final VisualizationWrappedRootDoc rootDoc = new VisualizationWrappedRootDoc(root);
        htmlDoclet.configuration.root = root;

        try {
            htmlDoclet.configuration.setOptions();
        } catch (Configuration.Fault fault) {
            fault.printStackTrace();
        }

        for (ClassDoc cDoc : rootDoc.classes()) {

            if (log.isDebugEnabled()) {
                log.debug(getJavaDocAndTagsLog(cDoc));
            }
        }

        for (PackageDoc pDoc : rootDoc.specifiedPackages()) {

            if (log.isDebugEnabled()) {
                log.debug(getJavaDocAndTagsLog(pDoc));
            }
        }


        return HtmlDoclet.start(root);
    } 

  public static int optionLength(final String option) {
    if ("-jaxrscontext".equals(option)
        || "-matchingpojonamesonly".equals(option)
        || "-matchingresourcesonly".equals(option)
        || "-pathexcludefilter".equals(option)) {
      return 2;
    }
    if ("-disablehttpexample".equals(option)
        || "-disablejavascriptexample".equals(option)
        || "-enablepojojson".equals(option)) {
      return 1;
    }
    return HtmlDoclet.optionLength(option);
  } 

  public static boolean validOptions(final String[][] options, final DocErrorReporter reporter) {
    if (!HtmlDoclet.validOptions(options, reporter)) {
      return false;
    }
    List<String> values = Utils.getOptions(options, "-pathexcludefilter");
    for(String value : values){
      try {
        Pattern.compile(value);
      } catch (Throwable t) {
        reporter.printError("Invalid pattern for '-pathexcludefilter' option: '"+value+"' (not a valid regex)");
        return false;
      }
    }
    return true;
  } 

	public static int optionLength(String option) {
		switch (option) {
		default:
			return HtmlDoclet.optionLength(option);
		}
	} 

	public static boolean start(RootDoc root) {

		System.out.println("test");
		for (String[] o : root.options()) {
			for (String s : o) {
				System.out.println(s);
			}
		}

		ClassDoc[] classes = root.classes();

		for (ClassDoc classDoc : classes) {
			SourcePosition position = classDoc.position();
		}

		for (int i = 0; i < classes.length; ++i) {
			System.out.println(classes[i]);
		}
		return HtmlDoclet.start(root);
	} 

    public static int optionLength(String option) {
        if (option.equals(OPTION_TEMPLATE)) return 2;
        if (option.equals(OPTION_REPORTDIR)) return 2;
        if (option.equals(OPTION_REPORTFILENAME)) return 2;
        if (option.equals(OPTION_SORTTAG)) return 2;
        if (option.equals(OPTION_SHEETINDEX)) return 2;
        if (option.equals(OPTION_CONVERTER)) return 2;
        if (option.equals(OPTION_JUNIT3FALLBACK)) return 2;
        if (option.equals(OPTION_RESIZEROW)) return 2;
        return HtmlDoclet.optionLength(option);
    } 

Advertisement
Javadoc
The class with "start" method, calls individual Writers.

This is NOT part of any sup

ported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice. @author Atul M Dambalkar @author Robert Field @author Jamie Ho

Read More
Advertisement