private void writeThrows(Declaration decl) throws IOException { boolean first = true; for (Annotation annotation : decl.getAnnotations()) { if (annotation.getName().equals("throws")) { String excType = annotation.getPositionalArguments().get(0); String excDesc = annotation.getPositionalArguments().size() == 2 ? annotation.getPositionalArguments().get(1) : null; if (first) { first = false; open("div class='throws section'"); around("span class='title'", "Throws: "); open("ul"); } open("li"); linkRenderer().to(excType).useScope(decl).write(); if (excDesc != null) { write(Util.wikiToHTML(Util.unquote(excDesc), linkRenderer().useScope(decl))); } close("li"); } } if (!first) { close("ul"); close("div"); } }
private void writeDeprecated(Declaration decl) throws IOException { Annotation deprecated = Util.findAnnotation(decl, "deprecated"); if (deprecated != null) { open("div class='deprecated section'"); String text = "__Deprecated:__ "; if (!deprecated.getPositionalArguments().isEmpty()) { String reason = deprecated.getPositionalArguments().get(0); if (reason != null) { text += Util.unquote(reason); } } write(Util.wikiToHTML(text, linkRenderer().useScope(decl))); close("div"); } }
private void writePlatform(Module module) throws IOException { if (module.isNative()) { List<String> backendNames = new ArrayList<String>(); for (Backend backend : module.getNativeBackends()) { backendNames.add(backend.name); } open("div class='platform section'"); around("span class='title'", "Platform: "); around("span class='value'", Util.join(", ", backendNames)); close("div"); } }
private void writeLicense(Module module) throws IOException { Annotation annotation = Util.getAnnotation(module.getUnit(), module.getAnnotations(), "license"); if (annotation == null) return; String license = annotation.getPositionalArguments().get(0); if (license == null || license.isEmpty()) return; open("div class='license section'"); around("span class='title'", "License: "); around("span class='value'", license); close("div"); }
protected final void writeTagged(Declaration decl) throws IOException { List<String> tags = Util.getTags(decl); if (!tags.isEmpty()) { open("div class='tags section'"); Iterator<String> tagIterator = tags.iterator(); while (tagIterator.hasNext()) { String tag = tagIterator.next(); write( "<a class='tag label' name='" + tag + "' href='search.html?q=" + tag + "'>" + tag + "</a>"); } close("div"); } }
protected final void writeSee(Declaration decl) throws IOException { Annotation see = Util.getAnnotation(decl, "see"); if (see == null) return; open("div class='see section'"); around("span class='title'", "See also: "); open("span class='value'"); boolean first = true; for (String target : see.getPositionalArguments()) { if (!first) { write(", "); } else { first = false; } linkRenderer().to(target).useScope(decl).write(); } close("span"); close("div"); }