/** * Return the sub-class/interface list for the class/interface passed. * * @param cd class/interface whose sub-class/interface list is required. * @param isEnum true if the subclasses should be forced to come from the enum tree. */ public List subs(ClassDoc cd, boolean isEnum) { if (isEnum) { return get(subEnums, cd); } else if (cd.isAnnotationType()) { return get(subAnnotationTypes, cd); } else if (cd.isInterface()) { return get(subinterfaces, cd); } else if (cd.isClass()) { return get(subclasses, cd); } else { return null; } }
/** * Build the sorted list of all the deprecated APIs in this run. Build separate lists for * deprecated packages, classes, constructors, methods and fields. * * @param configuration the current configuration of the doclet. */ private void buildDeprecatedAPIInfo(Configuration configuration) { PackageDoc[] packages = configuration.packages; PackageDoc pkg; for (int c = 0; c < packages.length; c++) { pkg = packages[c]; if (Util.isDeprecated(pkg)) { getList(PACKAGE).add(pkg); } } ClassDoc[] classes = configuration.root.classes(); for (int i = 0; i < classes.length; i++) { ClassDoc cd = classes[i]; if (Util.isDeprecated(cd)) { if (cd.isOrdinaryClass()) { getList(CLASS).add(cd); } else if (cd.isInterface()) { getList(INTERFACE).add(cd); } else if (cd.isException()) { getList(EXCEPTION).add(cd); } else if (cd.isEnum()) { getList(ENUM).add(cd); } else if (cd.isError()) { getList(ERROR).add(cd); } else if (cd.isAnnotationType()) { getList(ANNOTATION_TYPE).add(cd); } } composeDeprecatedList(getList(FIELD), cd.fields()); composeDeprecatedList(getList(METHOD), cd.methods()); composeDeprecatedList(getList(CONSTRUCTOR), cd.constructors()); if (cd.isEnum()) { composeDeprecatedList(getList(ENUM_CONSTANT), cd.enumConstants()); } if (cd.isAnnotationType()) { composeDeprecatedList(getList(ANNOTATION_TYPE_MEMBER), ((AnnotationTypeDoc) cd).elements()); } } sortDeprecatedLists(); }
/** * Given a ClassDoc, return the name of its type (Class, Interface, etc.). * * @param cd the ClassDoc to check. * @param lowerCaseOnly true if you want the name returned in lower case. If false, the first * letter of the name is capatilized. * @return */ public static String getTypeName(Configuration config, ClassDoc cd, boolean lowerCaseOnly) { String typeName = ""; if (cd.isOrdinaryClass()) { typeName = "doclet.Class"; } else if (cd.isInterface()) { typeName = "doclet.Interface"; } else if (cd.isException()) { typeName = "doclet.Exception"; } else if (cd.isError()) { typeName = "doclet.Error"; } else if (cd.isAnnotationType()) { typeName = "doclet.AnnotationType"; } else if (cd.isEnum()) { typeName = "doclet.Enum"; } return config.getText(lowerCaseOnly ? typeName.toLowerCase() : typeName); }
/** * Add the given class to the catalog. * * @param classdoc the ClassDoc to add to the catelog. */ public void addClassDoc(ClassDoc classdoc) { if (classdoc == null) { return; } addClass(classdoc, allClasses); if (classdoc.isOrdinaryClass()) { addClass(classdoc, ordinaryClasses); } else if (classdoc.isException()) { addClass(classdoc, exceptions); } else if (classdoc.isEnum()) { addClass(classdoc, enums); } else if (classdoc.isAnnotationType()) { addClass(classdoc, annotationTypes); } else if (classdoc.isError()) { addClass(classdoc, errors); } else if (classdoc.isInterface()) { addClass(classdoc, interfaces); } }