use of com.sun.javadoc.ConstructorDoc in project com.revolsys.open by revolsys.
the class ClientDoclet method documentationClass.
public void documentationClass(final String classType, final ClassDoc classDoc) {
final String id = getClassId(classDoc);
final String name = classDoc.name();
DocletUtil.panelStart(this.writer, "panel-primary", HtmlElem.H3, id, classType, name, null);
DocletUtil.description(this.writer, classDoc, classDoc);
final ConstructorDoc[] constructors = classDoc.constructors();
if (constructors.length > 0) {
for (final ConstructorDoc method : constructors) {
documentationMethod(method);
}
}
final MethodDoc[] methods = classDoc.methods();
if (methods.length > 0) {
for (final MethodDoc method : methods) {
documentationMethod(method);
}
}
DocletUtil.panelEnd(this.writer);
}
use of com.sun.javadoc.ConstructorDoc in project com.revolsys.open by revolsys.
the class JavaDoclet method documentationClass.
public void documentationClass(final ClassDoc classDoc) {
this.writer.startTag(HtmlElem.DIV);
this.writer.attribute(HtmlAttr.CLASS, "javaClass");
final String name = classDoc.name();
DocletUtil.title(this.writer, getClassId(classDoc), name);
this.writer.startTag(HtmlElem.DIV);
this.writer.attribute(HtmlAttr.CLASS, "content");
DocletUtil.description(this.writer, classDoc, classDoc);
final ConstructorDoc[] constructors = classDoc.constructors();
if (constructors.length > 0) {
DocletUtil.title(this.writer, HtmlElem.H3, "Constructors");
for (final ConstructorDoc method : constructors) {
documentationMethod(method);
}
}
final MethodDoc[] methods = classDoc.methods();
if (methods.length > 0) {
DocletUtil.title(this.writer, HtmlElem.H3, "Methods");
for (final MethodDoc method : methods) {
documentationMethod(method);
}
}
this.writer.endTagLn(HtmlElem.DIV);
this.writer.endTagLn(HtmlElem.DIV);
}
use of com.sun.javadoc.ConstructorDoc in project Orchid by JavaEden.
the class ClassDocParser method getClassConstructors.
public JSONArray getClassConstructors(ClassDoc classDoc) {
JSONArray ctors = new JSONArray();
for (ConstructorDoc cDoc : classDoc.constructors()) {
JSONObject ctor = new JSONObject();
ctor.put("comment", commentParser.getCommentObject(cDoc));
ctor.put("annotations", annotationParser.getAnnotations(cDoc));
ctor.put("parameters", parameterParser.getParameters(cDoc));
ctors.put(ctor);
}
return ctors;
}
use of com.sun.javadoc.ConstructorDoc in project h2database by h2database.
the class Doclet method processClass.
private void processClass(ClassDoc clazz) throws IOException {
String packageName = clazz.containingPackage().name();
String dir = destDir + "/" + packageName.replace('.', '/');
(new File(dir)).mkdirs();
String fileName = dir + "/" + clazz.name() + ".html";
String className = getClass(clazz);
FileWriter out = new FileWriter(fileName);
PrintWriter writer = new PrintWriter(new BufferedWriter(out));
writer.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD " + "XHTML 1.0 Strict//EN\" " + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
String language = "en";
writer.println("<html xmlns=\"http://www.w3.org/1999/xhtml\" " + "lang=\"" + language + "\" xml:lang=\"" + language + "\">");
writer.println("<head>" + "<meta http-equiv=\"Content-Type\" " + "content=\"text/html;charset=utf-8\" /><title>");
writer.println(className);
writer.println("</title>" + "<link rel=\"stylesheet\" type=\"text/css\" " + "href=\"../../../stylesheet.css\" />");
writer.println("<script type=\"text/javascript\" " + "src=\"../../../animate.js\"></script>");
writer.println("</head><body onload=\"openLink();\">");
writer.println("<table class=\"content\">" + "<tr class=\"content\">" + "<td class=\"content\">" + "<div class=\"contentDiv\">");
writer.println("<h1>" + className + "</h1>");
writer.println(formatText(clazz.commentText()) + "<br /><br />");
// methods
ConstructorDoc[] constructors = clazz.constructors();
MethodDoc[] methods = clazz.methods();
ExecutableMemberDoc[] constructorsMethods = new ExecutableMemberDoc[constructors.length + methods.length];
System.arraycopy(constructors, 0, constructorsMethods, 0, constructors.length);
System.arraycopy(methods, 0, constructorsMethods, constructors.length, methods.length);
Arrays.sort(constructorsMethods, new Comparator<ExecutableMemberDoc>() {
@Override
public int compare(ExecutableMemberDoc a, ExecutableMemberDoc b) {
// sort static method before non-static methods
if (a.isStatic() != b.isStatic()) {
return a.isStatic() ? -1 : 1;
}
return a.name().compareTo(b.name());
}
});
//
//
// Arrays.sort(methods, new Comparator<MethodDoc>() {
// public int compare(MethodDoc a, MethodDoc b) {
// // sort static method before non-static methods
// if (a.isStatic() != b.isStatic()) {
// return a.isStatic() ? -1 : 1;
// }
// return a.name().compareTo(b.name());
// }
// });
ArrayList<String> signatures = new ArrayList<>();
boolean hasMethods = false;
int id = 0;
for (int i = 0; i < constructorsMethods.length; i++) {
ExecutableMemberDoc method = constructorsMethods[i];
String name = method.name();
if (skipMethod(method)) {
continue;
}
if (!hasMethods) {
writer.println("<table class=\"block\">" + "<tr onclick=\"return allDetails()\">" + "<th colspan=\"2\">Methods</th></tr>");
hasMethods = true;
}
String type = getTypeName(method.isStatic(), false, getReturnType(method));
writer.println("<tr id=\"__" + id + "\" onclick=\"return on(" + id + ")\">");
writer.println("<td class=\"return\">" + type + "</td><td class=\"method\">");
Parameter[] params = method.parameters();
StringBuilder buff = new StringBuilder();
StringBuilder buffSignature = new StringBuilder(name);
buff.append('(');
for (int j = 0; j < params.length; j++) {
if (j > 0) {
buff.append(", ");
}
buffSignature.append('_');
Parameter param = params[j];
boolean isVarArgs = method.isVarArgs() && j == params.length - 1;
String typeName = getTypeName(false, isVarArgs, param.type());
buff.append(typeName);
buffSignature.append(StringUtils.replaceAll(typeName, "[]", "-"));
buff.append(' ');
buff.append(param.name());
}
buff.append(')');
if (isDeprecated(method)) {
name = "<span class=\"deprecated\">" + name + "</span>";
}
String signature = buffSignature.toString();
while (signatures.size() < i) {
signatures.add(null);
}
signatures.add(i, signature);
writer.println("<a id=\"" + signature + "\" href=\"#" + signature + "\">" + name + "</a>" + buff.toString());
String firstSentence = getFirstSentence(method.firstSentenceTags());
if (firstSentence != null) {
writer.println("<div class=\"methodText\">" + formatText(firstSentence) + "</div>");
}
writer.println("</td></tr>");
writer.println("<tr onclick=\"return off(" + id + ")\" class=\"detail\" id=\"_" + id + "\">");
writer.println("<td class=\"return\">" + type + "</td><td>");
writeMethodDetails(writer, clazz, method, signature);
writer.println("</td></tr>");
id++;
}
if (hasMethods) {
writer.println("</table>");
}
// field overview
FieldDoc[] fields = clazz.fields();
if (clazz.interfaces().length > 0) {
fields = clazz.interfaces()[0].fields();
}
Arrays.sort(fields, new Comparator<FieldDoc>() {
@Override
public int compare(FieldDoc a, FieldDoc b) {
return a.name().compareTo(b.name());
}
});
int fieldId = 0;
for (FieldDoc field : fields) {
if (skipField(clazz, field)) {
continue;
}
String name = field.name();
String text = field.commentText();
if (text == null || text.trim().length() == 0) {
addError("Undocumented field (" + getLink(clazz, field.position().line()) + ") " + name);
}
if (text != null && text.startsWith("INTERNAL")) {
continue;
}
if (fieldId == 0) {
writer.println("<br /><table><tr><th colspan=\"2\">Fields</th></tr>");
}
String type = getTypeName(true, false, field.type());
writer.println("<tr><td class=\"return\">" + type + "</td><td class=\"method\">");
String constant = field.constantValueExpression();
// add a link (a name) if there is a <code> tag
String link = getFieldLink(text, constant, clazz, name);
writer.print("<a href=\"#" + link + "\">" + name + "</a>");
if (constant == null) {
writer.println();
} else {
writer.println(" = " + constant);
}
writer.println("</td></tr>");
fieldId++;
}
if (fieldId > 0) {
writer.println("</table>");
}
// field details
Arrays.sort(fields, new Comparator<FieldDoc>() {
@Override
public int compare(FieldDoc a, FieldDoc b) {
String ca = a.constantValueExpression();
if (ca == null) {
ca = a.name();
}
String cb = b.constantValueExpression();
if (cb == null) {
cb = b.name();
}
return ca.compareTo(cb);
}
});
for (FieldDoc field : fields) {
writeFieldDetails(writer, clazz, field);
}
writer.println("</div></td></tr></table></body></html>");
writer.close();
out.close();
}
Aggregations