/** * Add the modifier for the member. * * @param member the member to add the type for * @param code the content tree to which the modified will be added */ private void addModifier(ProgramElementDoc member, Content code) { if (member.isProtected()) { code.addContent("protected "); } else if (member.isPrivate()) { code.addContent("private "); } else if (!member.isPublic()) { // Package private code.addContent(configuration.getText("doclet.Package_private")); code.addContent(" "); } if (member.isMethod()) { if (!(member.containingClass().isInterface()) && ((MethodDoc) member).isAbstract()) { code.addContent("abstract "); } // This check for isDefault() and the default modifier needs to be // added for it to appear on the "Modifier and Type" column in the // method summary 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. if (((MethodDoc) member).isDefault()) { code.addContent("default "); } } if (member.isStatic()) { code.addContent("static "); } }
/** * Construct a new ConstructorWriterImpl. * * @param writer The writer for the class that the constructors belong to. * @param classDoc the class being documented. */ public ConstructorWriterImpl(SubWriterHolderWriter writer, ClassDoc classDoc) { super(writer, classDoc); VisibleMemberMap visibleMemberMap = new VisibleMemberMap(classDoc, VisibleMemberMap.CONSTRUCTORS, configuration); List<ProgramElementDoc> constructors = new ArrayList<>(visibleMemberMap.getMembersFor(classDoc)); for (ProgramElementDoc constructor : constructors) { if (constructor.isProtected() || constructor.isPrivate()) { setFoundNonPubConstructor(true); } } }
/** {@inheritDoc} */ protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) { if (foundNonPubConstructor) { Content code = new HtmlTree(HtmlTag.CODE); if (member.isProtected()) { code.addContent("protected "); } else if (member.isPrivate()) { code.addContent("private "); } else if (member.isPublic()) { code.addContent(writer.getSpace()); } else { code.addContent(configuration.getText("doclet.Package_private")); } tdSummaryType.addContent(code); } }