/** * 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 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; }
private Type[] getInterfaceTypeArguments(ClassDoc iface, Type t) { if (t instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType) t; if (iface != null && iface.equals(t.asClassDoc())) { return pt.typeArguments(); } else { for (Type pti : pt.interfaceTypes()) { Type[] result = getInterfaceTypeArguments(iface, pti); if (result != null) return result; } if (pt.superclassType() != null) return getInterfaceTypeArguments(iface, pt.superclassType()); } } else if (t instanceof ClassDoc) { ClassDoc cd = (ClassDoc) t; for (Type pti : cd.interfaceTypes()) { Type[] result = getInterfaceTypeArguments(iface, pti); if (result != null) return result; } if (cd.superclassType() != null) return getInterfaceTypeArguments(iface, cd.superclassType()); } return null; }