/** * Set the commons attribute and child nodes for method and constructor nodes. * * @param member The executable member documentation. * @param node The node to update */ private static void updateExecutableMemberNode(ExecutableMemberDoc member, XMLNode node) { // Add the basic attribute values node.attribute("name", member.name()); node.attribute("static", member.isStatic()); node.attribute("interface", member.isInterface()); node.attribute("final", member.isFinal()); node.attribute("visibility", getVisibility(member)); node.attribute("synchronized", member.isSynchronized()); node.attribute("synthetic", member.isSynthetic()); // Comment node.child(toComment(member)); // Other objects attached to the method/constructor. node.child(toTags(member)); node.child(toSeeNodes(member.seeTags())); node.child(toParametersNode(member.parameters(), member.paramTags())); node.child(toExceptionsNode(member.thrownExceptions(), member.throwsTags())); }
/** * Appends to the current document a link that is * built from the given ``element``. Such links is * usually leading to the internal corresponding * document section * * @param element Element to build link from. */ public void linkedName(final ProgramElementDoc element) { final StringBuffer anchorBuilder = new StringBuffer() .append('#') .append(element.name()); if (element instanceof ExecutableMemberDoc) { final ExecutableMemberDoc member = (ExecutableMemberDoc) element; final Parameter[] parameters = member.parameters(); if (parameters.length == 0) { // Empty constructor case. } for (int i = 0; i < parameters.length; i++) { anchorBuilder.append(parameters[i].type().simpleTypeName()); if (i < parameters.length - 1) { anchorBuilder.append('-'); } } } final String url = anchorBuilder.toString().toLowerCase(); link(element.name(), url); }
/** * @return the full JSON for the given ExecutableMemberDoc */ protected JSONObject processExecutableMemberDoc(ExecutableMemberDoc emDoc) { JSONObject retMe = processMemberDoc(emDoc); retMe.put("flatSignature", emDoc.flatSignature()); retMe.put("signature", emDoc.signature()); retMe.put("parameters", processParameters(emDoc.parameters())); retMe.put("paramTags", processParamTags(emDoc.paramTags())); retMe.put("thrownExceptions", processClassDocStubs(emDoc.thrownExceptions())); retMe.put("thrownExceptionTypes", processTypes(emDoc.thrownExceptionTypes())); retMe.put("typeParameters", processTypeVariables(emDoc.typeParameters())); retMe.put("typeParamTags", processParamTags(emDoc.typeParamTags())); retMe.put("throwsTags", processThrowsTags(emDoc.throwsTags())); return retMe; }
/** * Set the commons attribute and child nodes for method and constructor nodes. * * @param member The executable member documentation. * @param node The node to update */ private static void updateExecutableMemberNode(ExecutableMemberDoc member, XMLNode node) { // Add the basic attribute values node.attribute("name", member.name()); node.attribute("static", member.isStatic()); node.attribute("interface", member.isInterface()); node.attribute("final", member.isFinal()); node.attribute("visibility", getVisibility(member)); node.attribute("synchronized", member.isSynchronized()); node.attribute("synthetic", member.isSynthetic()); // Comments node.child(toShortComment(member)); node.child(toComment(member)); // Other objects attached to the method/constructor. node.child(toTags(member)); node.child(toSeeNodes(member.seeTags())); node.child(toParametersNode(member.parameters(), member.paramTags(), member.isVarArgs())); node.child(toExceptionsNode(member.thrownExceptionTypes(), member.throwsTags())); }
private static Type getReturnType(ExecutableMemberDoc method) { if (method instanceof MethodDoc) { MethodDoc m = (MethodDoc) method; return m.returnType(); } return null; }
private boolean doesOverride(ExecutableMemberDoc method) { if (method.isConstructor()) { return true; } ClassDoc clazz = method.containingClass(); int parameterCount = method.parameters().length; return foundMethod(clazz, false, method.name(), parameterCount); }
private static boolean isDeprecated(ExecutableMemberDoc method) { for (Tag t : method.tags()) { if (t.kind().equals("@deprecated")) { return true; } } return false; }
protected SortedSet getThrownExceptions(ExecutableMemberDoc execMemberDoc) { SortedSet result = new TreeSet(); ClassDoc[] thrownExceptions = execMemberDoc.thrownExceptions(); for (int j=0; j<thrownExceptions.length; ++j) { result.add(thrownExceptions[j]); } return result; }
/** * Appends to the current document the signature * of the given ``member`` as a table row. * * @param element Member to write signature from. */ public void rowSignature(final ProgramElementDoc element) { startTableRow(); returnSignature(element); cell(); linkedName(element); if (element instanceof ExecutableMemberDoc) { final ExecutableMemberDoc member = (ExecutableMemberDoc) element; inlineParameters(member.parameters()); } endTableRow(); newLine(); }
/** * Appends to the current document the signature * of the given ``member`` as a list item. * * @param element Member to write signature from. */ public void itemSignature(final ProgramElementDoc element) { item(); returnSignature(element); character(' '); linkedName(element); if (element instanceof ExecutableMemberDoc) { final ExecutableMemberDoc member = (ExecutableMemberDoc) element; inlineParameters(member.parameters()); } newLine(); }
/** * @return a JSON stub for the given ExecutableMemberDoc */ protected JSONObject processExecutableMemberDocStub(ExecutableMemberDoc emDoc) { JSONObject retMe = processMemberDocStub(emDoc); retMe.put("parameters", processParameterStubs(emDoc.parameters())); retMe.put("flatSignature", emDoc.flatSignature()); retMe.put("thrownExceptionTypes", processTypes(emDoc.thrownExceptionTypes())); retMe.put("typeParameters", processTypeVariables(emDoc.typeParameters())); return retMe; }
@Override public DocReferenceable getExecutableMemberDocRef(ExecutableMemberDoc executableMemberDoc) { if (packageList.contains(executableMemberDoc.containingPackage().name())) { return new ExternalRef(executableMemberDoc); } return null; }
public ExternalRef(ExecutableMemberDoc executableMemberDoc) { name = executableMemberDoc.name() + "()"; qualifiedName = executableMemberDoc.containingClass().qualifiedName() + "#" + executableMemberDoc.name() + executableMemberDoc.signature(); url = ExternalRefProvider.this.url + executableMemberDoc.containingPackage().name().replace('.', '/') + "/" + executableMemberDoc.containingClass().name() + ".html#" + executableMemberDoc.name() + executableMemberDoc.signature(); }
@Override public DocReferenceable getExecutableMemberDocRef(ExecutableMemberDoc executableMemberDoc) { for (IRefProvider provider : apiRefProviderList) { DocReferenceable result = provider.getExecutableMemberDocRef(executableMemberDoc); if (result != null) { return result; } } return unknownRefProvider.getExecutableMemberDocRef(executableMemberDoc); }
public ApiPageRef(ExecutableMemberDoc executableMemberDoc, ApiPage apiPage) { this.name = executableMemberDoc.containingClass().name() + '.' + executableMemberDoc.name() + executableMemberDoc.flatSignature(); this.qualifiedName = executableMemberDoc.containingClass().qualifiedName() + "#" + executableMemberDoc.name() + executableMemberDoc.signature(); this.apiPage = apiPage; this.anchor = executableMemberDoc.name() + executableMemberDoc.signature(); }
@Override public DocReferenceable getExecutableMemberDocRef(ExecutableMemberDoc executableMemberDoc) { ApiPage page = docPageStore.getClassPage(executableMemberDoc.containingClass()); if (page != null) { return new ApiPageRef(executableMemberDoc, page); } return null; }
private boolean skipMethod(ExecutableMemberDoc method) { ClassDoc clazz = method.containingClass(); boolean isAbstract = method instanceof MethodDoc && ((MethodDoc) method).isAbstract(); boolean isInterface = clazz.isInterface() || (clazz.isAbstract() && isAbstract); if (INTERFACES_ONLY && !isInterface) { return true; } String name = method.name(); if (method.isPrivate() || name.equals("finalize")) { return true; } if (method.isConstructor() && method.getRawCommentText().trim().length() == 0) { return true; } if (method.getRawCommentText().trim() .startsWith("@deprecated INTERNAL")) { return true; } String firstSentence = getFirstSentence(method.firstSentenceTags()); String raw = method.getRawCommentText(); if (firstSentence != null && firstSentence.startsWith("INTERNAL")) { return true; } if ((firstSentence == null || firstSentence.trim().length() == 0) && raw.indexOf("{@inheritDoc}") < 0) { if (!doesOverride(method)) { boolean setterOrGetter = name.startsWith("set") && method.parameters().length == 1; setterOrGetter |= name.startsWith("get") && method.parameters().length == 0; Type returnType = getReturnType(method); setterOrGetter |= name.startsWith("is") && method.parameters().length == 0 && returnType != null && returnType.toString().equals("boolean"); if (!setterOrGetter) { addError("Undocumented method " + " (" + getLink(clazz, method.position().line()) + ") " + clazz + "." + name + " " + raw); return true; } } } return false; }
@Override public DocReferenceable getExecutableMemberDocRef(ExecutableMemberDoc executableMemberDoc) { return new UnknownApiRef(executableMemberDoc.name()); }
/** * Appends to the current document the signature * of the given ``member`` as a level 4 header. * * @param member Member to write signature from. */ private void headerSignature(final ExecutableMemberDoc member) { header(2); text(member.name()); text(member.flatSignature()); }
/** * Gets a reference to a executable member. * * @param executableMemberDoc javadoc executable member doc * @return a DocReferenceable, null if not found */ DocReferenceable getExecutableMemberDocRef(ExecutableMemberDoc executableMemberDoc);