/** * 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); }
/** * 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; }