public boolean isPublic() { return wrapped.isPublic(); }
/** * Given a class, return the closest visible super class. * * @param classDoc the class we are searching the parent for. * @param configuration the current configuration of the doclet. * @return the closest visible super class. Return null if it cannot * be found (i.e. classDoc is java.lang.Object). */ public static ClassDoc getFirstVisibleSuperClassCD(ClassDoc classDoc, Configuration configuration) { if (classDoc == null) { return null; } ClassDoc supClassDoc = classDoc.superclass(); while (supClassDoc != null && (! (supClassDoc.isPublic() || isLinkable(supClassDoc, configuration))) ) { supClassDoc = supClassDoc.superclass(); } if (classDoc.equals(supClassDoc)) { return null; } return supClassDoc; }
/** * Given a class, return the closest visible super class. * * @param classDoc the class we are searching the parent for. * @param configuration the current configuration of the doclet. * @return the closest visible super class. Return null if it cannot * be found (i.e. classDoc is java.lang.Object). */ public static ClassDoc getFirstVisibleSuperClassCD(ClassDoc classDoc, Configuration configuration) { if (classDoc == null) { return null; } ClassDoc supClassDoc = classDoc.superclass(); while (supClassDoc != null && (! (supClassDoc.isPublic() || isLinkable(supClassDoc, configuration))) ) { supClassDoc = supClassDoc.superclass(); } if (classDoc.equals(supClassDoc)) { return null; } return supClassDoc; }
iter.hasNext();) { ClassDoc inhclass = iter.next(); if (! (inhclass.isPublic() || Util.isLinkable(inhclass, configuration))) { continue;
private static void addAllInterfaceTypes(Map<ClassDoc,Type> results, Type type, Type[] interfaceTypes, boolean raw, Configuration configuration) { for (int i = 0; i < interfaceTypes.length; i++) { Type interfaceType = interfaceTypes[i]; ClassDoc interfaceClassDoc = interfaceType.asClassDoc(); if (! (interfaceClassDoc.isPublic() || (configuration != null && isLinkable(interfaceClassDoc, configuration)))) { continue; } if (raw) interfaceType = interfaceType.asClassDoc(); results.put(interfaceClassDoc, interfaceType); List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration); for (Iterator<Type> iter = superInterfaces.iterator(); iter.hasNext(); ) { Type superInterface = iter.next(); results.put(superInterface.asClassDoc(), superInterface); } } if (type instanceof ParameterizedType) findAllInterfaceTypes(results, (ParameterizedType) type, configuration); else if (((ClassDoc) type).typeParameters().length == 0) findAllInterfaceTypes(results, (ClassDoc) type, raw, configuration); else findAllInterfaceTypes(results, (ClassDoc) type, true, configuration); }
/** * Return true if this class is linkable and false if we can't link to the * desired class. * <br> * <b>NOTE:</b> You can only link to external classes if they are public or * protected. * * @param classDoc the class to check. * @param configuration the current configuration of the doclet. * * @return true if this class is linkable and false if we can't link to the * desired class. */ public static boolean isLinkable(ClassDoc classDoc, Configuration configuration) { return ((classDoc.isIncluded() && configuration.isGeneratedDoc(classDoc))) || (configuration.extern.isExternal(classDoc) && (classDoc.isPublic() || classDoc.isProtected())); }
/** * Return true if this class is linkable and false if we can't link to the * desired class. * <br> * <b>NOTE:</b> You can only link to external classes if they are public or * protected. * * @param classDoc the class to check. * @param configuration the current configuration of the doclet. * * @return true if this class is linkable and false if we can't link to the * desired class. */ public static boolean isLinkable(ClassDoc classDoc, Configuration configuration) { return ((classDoc.isIncluded() && configuration.isGeneratedDoc(classDoc))) || (configuration.extern.isExternal(classDoc) && (classDoc.isPublic() || classDoc.isProtected())); }
private static void addAllInterfaceTypes(Map<ClassDoc,Type> results, Type type, Type[] interfaceTypes, boolean raw, Configuration configuration) { for (int i = 0; i < interfaceTypes.length; i++) { Type interfaceType = interfaceTypes[i]; ClassDoc interfaceClassDoc = interfaceType.asClassDoc(); if (! (interfaceClassDoc.isPublic() || (configuration != null && isLinkable(interfaceClassDoc, configuration)))) { continue; } if (raw) interfaceType = interfaceType.asClassDoc(); results.put(interfaceClassDoc, interfaceType); List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration); for (Iterator<Type> iter = superInterfaces.iterator(); iter.hasNext(); ) { Type superInterface = iter.next(); results.put(superInterface.asClassDoc(), superInterface); } } if (type instanceof AnnotatedType) type = ((AnnotatedType)type).underlyingType(); if (type instanceof ParameterizedType) findAllInterfaceTypes(results, (ParameterizedType) type, configuration); else if (((ClassDoc) type).typeParameters().length == 0) findAllInterfaceTypes(results, (ClassDoc) type, raw, configuration); else findAllInterfaceTypes(results, (ClassDoc) type, true, configuration); }
/** * Given a class, return the closest visible super class. * * @param classDoc the class we are searching the parent for. * @param configuration the current configuration of the doclet. * @return the closest visible super class. Return null if it cannot * be found (i.e. classDoc is java.lang.Object). */ public static Type getFirstVisibleSuperClass(ClassDoc classDoc, Configuration configuration) { if (classDoc == null) { return null; } Type sup = classDoc.superclassType(); ClassDoc supClassDoc = classDoc.superclass(); while (sup != null && (! (supClassDoc.isPublic() || isLinkable(supClassDoc, configuration))) ) { if (supClassDoc.superclass().qualifiedName().equals(supClassDoc.qualifiedName())) break; sup = supClassDoc.superclassType(); supClassDoc = supClassDoc.superclass(); } if (classDoc.equals(supClassDoc)) { return null; } return sup; }
/** * {@inheritDoc} */ public void writeConstantMembersHeader(ClassDoc cd) { //generate links backward only to public classes. String classlink = (cd.isPublic() || cd.isProtected())? getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, cd, false)) : cd.qualifiedName(); String name = cd.containingPackage().name(); if (name.length() > 0) { writeClassName(name + "." + classlink); } else { writeClassName(classlink); } }
/** * Given a class, return the closest visible super class. * * @param classDoc the class we are searching the parent for. * @param configuration the current configuration of the doclet. * @return the closest visible super class. Return null if it cannot * be found (i.e. classDoc is java.lang.Object). */ public static Type getFirstVisibleSuperClass(ClassDoc classDoc, Configuration configuration) { if (classDoc == null) { return null; } Type sup = classDoc.superclassType(); ClassDoc supClassDoc = classDoc.superclass(); while (sup != null && (! (supClassDoc.isPublic() || isLinkable(supClassDoc, configuration))) ) { if (supClassDoc.superclass().qualifiedName().equals(supClassDoc.qualifiedName())) break; sup = supClassDoc.superclassType(); supClassDoc = supClassDoc.superclass(); } if (classDoc.equals(supClassDoc)) { return null; } return sup; }
/** * Return true if the given ClassDoc should be included * in the serialized form. * * @param cd the ClassDoc object to check for serializability. */ private static boolean serialClassInclude(ClassDoc cd) { if (cd.isEnum()) { return false; } try { cd.superclassType(); } catch (NullPointerException e) { //Workaround for null pointer bug in ClassDoc.superclassType(). return false; } if (cd.isSerializable()) { if (cd.tags("serial").length > 0) { return serialDocInclude(cd); } else if (cd.isPublic() || cd.isProtected()) { return true; } else { return false; } } return false; }
/** * Return true if the given ClassDoc should be included * in the serialized form. * * @param cd the ClassDoc object to check for serializability. */ private static boolean serialClassInclude(ClassDoc cd) { if (cd.isEnum()) { return false; } try { cd.superclassType(); } catch (NullPointerException e) { //Workaround for null pointer bug in ClassDoc.superclassType(). return false; } if (cd.isSerializable()) { if (cd.tags("serial").length > 0) { return serialDocInclude(cd); } else if (cd.isPublic() || cd.isProtected()) { return true; } else { return false; } } return false; }
/** * Get the table caption and header for the constant summary table * * @param cd classdoc to be documented * @return constant members header content */ public Content getConstantMembersHeader(ClassDoc cd) { //generate links backward only to public classes. Content classlink = (cd.isPublic() || cd.isProtected()) ? getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd)) : new StringContent(cd.qualifiedName()); String name = cd.containingPackage().name(); if (name.length() > 0) { Content cb = new ContentBuilder(); cb.addContent(name); cb.addContent("."); cb.addContent(classlink); return getClassName(cb); } else { return getClassName(classlink); } }
/** * {@inheritDoc} */ public void addComments(FieldDoc field, Content fieldDocTree) { ClassDoc holder = field.containingClass(); if (field.inlineTags().length > 0) { if (holder.equals(classdoc) || (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) { writer.addInlineComment(field, fieldDocTree); } else { Content link = writer.getDocLink(LinkInfoImpl.Kind.FIELD_DOC_COPY, holder, field, holder.isIncluded() ? holder.typeName() : holder.qualifiedTypeName(), false); Content codeLink = HtmlTree.CODE(link); Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.isClass()? writer.descfrmClassLabel : writer.descfrmInterfaceLabel); descfrmLabel.addContent(writer.getSpace()); descfrmLabel.addContent(codeLink); fieldDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel)); writer.addInlineComment(field, fieldDocTree); } } }
/** * {@inheritDoc} */ public void addComments(MethodDoc property, Content propertyDocTree) { ClassDoc holder = property.containingClass(); if (property.inlineTags().length > 0) { if (holder.equals(classdoc) || (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) { writer.addInlineComment(property, propertyDocTree); } else { Content link = writer.getDocLink(LinkInfoImpl.Kind.PROPERTY_DOC_COPY, holder, property, holder.isIncluded() ? holder.typeName() : holder.qualifiedTypeName(), false); Content codeLink = HtmlTree.CODE(link); Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.isClass()? writer.descfrmClassLabel : writer.descfrmInterfaceLabel); descfrmLabel.addContent(writer.getSpace()); descfrmLabel.addContent(codeLink); propertyDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel)); writer.addInlineComment(property, propertyDocTree); } } }
/** * {@inheritDoc} */ public void addComments(Type holder, MethodDoc method, Content methodDocTree) { ClassDoc holderClassDoc = holder.asClassDoc(); if (method.inlineTags().length > 0) { if (holder.asClassDoc().equals(classdoc) || (! (holderClassDoc.isPublic() || Util.isLinkable(holderClassDoc, configuration)))) { writer.addInlineComment(method, methodDocTree); } else { Content link = writer.getDocLink(LinkInfoImpl.Kind.METHOD_DOC_COPY, holder.asClassDoc(), method, holder.asClassDoc().isIncluded() ? holder.typeName() : holder.qualifiedTypeName(), false); Content codelLink = HtmlTree.CODE(link); Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.asClassDoc().isClass()? writer.descfrmClassLabel : writer.descfrmInterfaceLabel); descfrmLabel.addContent(writer.getSpace()); descfrmLabel.addContent(codelLink); methodDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel)); writer.addInlineComment(method, methodDocTree); } } }
writer.printMemberDetailsListStartTag(); if (holder.equals(classdoc) || (! (holder.isPublic() || Util.isLinkable(holder, configuration())))) { writer.dd(); writer.printInlineComment(field);
/** * Get the serializable class heading. * * @param classDoc the class being processed * @return a content tree for the class header */ public Content getClassHeader(ClassDoc classDoc) { Content classLink = (classDoc.isPublic() || classDoc.isProtected()) ? getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, classDoc) .label(configuration.getClassName(classDoc))) : new StringContent(classDoc.qualifiedName()); Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor( classDoc.qualifiedName())); Content superClassLink = classDoc.superclassType() != null ? getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.SERIALIZED_FORM, classDoc.superclassType())) : null; //Print the heading. Content className = superClassLink == null ? configuration.getResource( "doclet.Class_0_implements_serializable", classLink) : configuration.getResource( "doclet.Class_0_extends_implements_serializable", classLink, superClassLink); li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, className)); return li; }
String classLink = (classDoc.isPublic() || classDoc.isProtected())? getLink(new LinkInfoImpl(classDoc, configuration.getClassName(classDoc))):