/** * Add the modifier and type for the member in the member summary. * * @param member the member to add the type for * @param type the type to add * @param tdSummaryType the content tree to which the modified and type will be added */ protected void addModifierAndType(ProgramElementDoc member, Type type, Content tdSummaryType) { HtmlTree code = new HtmlTree(HtmlTag.CODE); addModifier(member, code); if (type == null) { if (member.isClass()) { code.addContent("class"); } else { code.addContent("interface"); } code.addContent(writer.getSpace()); } else { if (member instanceof ExecutableMemberDoc && ((ExecutableMemberDoc) member).typeParameters().length > 0) { Content typeParameters = ((AbstractExecutableMemberWriter) this).getTypeParameters((ExecutableMemberDoc) member); code.addContent(typeParameters); // Code to avoid ugly wrapping in member summary table. if (typeParameters.charCount() > 10) { code.addContent(new HtmlTree(HtmlTag.BR)); } else { code.addContent(writer.getSpace()); } code.addContent( writer.getLink( new LinkInfoImpl(configuration, LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type))); } else { code.addContent( writer.getLink( new LinkInfoImpl(configuration, LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type))); } } tdSummaryType.addContent(code); }
/** * Add the modifier for the member. * * @param member the member for which teh modifier will be added. * @param htmltree the content tree to which the modifier information will be added. */ protected void addModifiers(MemberDoc member, Content htmltree) { String mod = modifierString(member); // According to JLS, we should not be showing public modifier for // interface methods. if ((member.isField() || member.isMethod()) && writer instanceof ClassWriterImpl && ((ClassWriterImpl) writer).getClassDoc().isInterface()) { // This check for isDefault() and the default modifier needs to be // added for it to appear on the method details section. Once the // default modifier is added to the Modifier list on DocEnv and once // it is updated to use the javax.lang.model.element.Modifier, we // will need to remove this. mod = (member.isMethod() && ((MethodDoc) member).isDefault()) ? utils.replaceText(mod, "public", "default").trim() : utils.replaceText(mod, "public", "").trim(); } if (mod.length() > 0) { htmltree.addContent(mod); htmltree.addContent(writer.getSpace()); } }