public boolean isEnum() { return wrapped.isEnum(); }
public String getClassType() { if(this.classDoc.isInterface()) { return "interface"; } else if(this.classDoc.isAnnotationType()) { return "@interface"; } else if(this.classDoc.isEnum()) { return "enum"; } return "class"; }
/** * Construct a new ClassBuilder. * * @param context the build context * @param classDoc the class being documented. * @param writer the doclet specific writer. */ private ClassBuilder(Context context, ClassDoc classDoc, ClassWriter writer) { super(context); this.classDoc = classDoc; this.writer = writer; if (classDoc.isInterface()) { isInterface = true; isEnum = false; } else if (classDoc.isEnum()) { isInterface = false; isEnum = true; Util.setEnumDocumentation(configuration, classDoc); } else { isInterface = false; isEnum = false; } }
/** * Construct a new ClassBuilder. * * @param configuration the current configuration of the doclet. * @param classDoc the class being documented. * @param writer the doclet specific writer. */ public static ClassBuilder getInstance(Configuration configuration, ClassDoc classDoc, ClassWriter writer) throws Exception { ClassBuilder builder = new ClassBuilder(configuration); builder.configuration = configuration; builder.classDoc = classDoc; builder.writer = writer; if (classDoc.isInterface()) { builder.isInterface = true; } else if (classDoc.isEnum()) { builder.isEnum = true; Util.setEnumDocumentation(configuration, classDoc); } if(containingPackagesSeen == null) { containingPackagesSeen = new HashSet<String>(); } return builder; }
continue; if (classes[i].isEnum()) { processType(classes[i], configuration, baseEnums, subEnums); } else if (classes[i].isClass()) {
final Class<?> clazz = Class.forName(className, true, classLoader); final String fieldName = fieldDoc.name(); if (classDoc.isEnum())
/** * 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); }
/** * The entry point into parsing the javadoc. * * @param rootDoc * The RootDoc intstance obtained via the doclet API * @return The root node, containing everything parsed from javadoc doclet */ public Root parseRootDoc(RootDoc rootDoc) { Root rootNode = objectFactory.createRoot(); for (ClassDoc classDoc : rootDoc.classes()) { PackageDoc packageDoc = classDoc.containingPackage(); Package packageNode = packages.get(packageDoc.name()); if (packageNode == null) { packageNode = parsePackage(packageDoc); packages.put(packageDoc.name(), packageNode); rootNode.getPackage().add(packageNode); } if (classDoc instanceof AnnotationTypeDoc) { packageNode.getAnnotation().add(parseAnnotationTypeDoc((AnnotationTypeDoc) classDoc)); } else if (classDoc.isEnum()) { packageNode.getEnum().add(parseEnum(classDoc)); } else if (classDoc.isInterface()) { packageNode.getInterface().add(parseInterface(classDoc)); } else { packageNode.getClazz().add(parseClass(classDoc)); } } return rootNode; }
/** * 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; }
private static int getPrecedence(ClassDoc c) { if (c.isAnnotationType()) { return 0; } if (c.isEnum()) { return 1; } if (ClassDocGraph.isStaticType(c)) { return 2; } if (c.isInterface()) { return 3; } if (c.isAbstract()) { return 4; } if (c.isError() || c.isException()) { return 100; } return 50; } }
/** * 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; }
/** * 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 capitalized. * @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 ? StringUtils.toLowerCase(typeName) : typeName); }
private static String getStereotype(ClassDoc node) { String stereotype = node.isInterface()? "interface" : null; if (node.isException() || node.isError()) { stereotype = "exception"; } else if (node.isAnnotationType()) { stereotype = "annotation"; } else if (node.isEnum()) { stereotype = "enum"; } else if (isStaticType(node)) { stereotype = "static"; } if (node.tags(TAG_STEREOTYPE).length > 0) { stereotype = node.tags(TAG_STEREOTYPE)[0].text(); } return escape(stereotype); }
} else if (cd.isException()) { getList(EXCEPTION).add(cd); } else if (cd.isEnum()) { getList(ENUM).add(cd); } else if (cd.isError()) { composeDeprecatedList(getList(METHOD), cd.methods()); composeDeprecatedList(getList(CONSTRUCTOR), cd.constructors()); if (cd.isEnum()) { composeDeprecatedList(getList(ENUM_CONSTANT), cd.enumConstants());
/** Print a class's relations */ public void printRelations(ClassDoc c) { Options opt = optionProvider.getOptionsFor(c); if (hidden(c) || c.name().equals("")) // avoid phantom classes, they may pop up when the source uses annotations return; // Print generalization (through the Java superclass) Type s = c.superclassType(); ClassDoc sc = s != null && !s.qualifiedTypeName().equals(Object.class.getName()) ? s.asClassDoc() : null; if (sc != null && !c.isEnum() && !hidden(sc)) relation(opt, RelationType.EXTENDS, c, sc, null, null, null); // Print generalizations (through @extends tags) for (Tag tag : c.tags("extends")) if (!hidden(tag.text())) relation(opt, RelationType.EXTENDS, c, c.findClass(tag.text()), null, null, null); // Print realizations (Java interfaces) for (Type iface : c.interfaceTypes()) { ClassDoc ic = iface.asClassDoc(); if (!hidden(ic)) relation(opt, RelationType.IMPLEMENTS, c, ic, null, null, null); } // Print other associations allRelation(opt, RelationType.COMPOSED, c); allRelation(opt, RelationType.NAVCOMPOSED, c); allRelation(opt, RelationType.HAS, c); allRelation(opt, RelationType.NAVHAS, c); allRelation(opt, RelationType.ASSOC, c); allRelation(opt, RelationType.NAVASSOC, c); allRelation(opt, RelationType.DEPEND, c); }
/** * 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); } }
/** * 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); } }
/** * Given a class, return the appropriate tool tip. * * @param classDoc the class to get the tool tip for. * @return the tool tip for the appropriate class. */ private String getClassToolTip(ClassDoc classDoc, boolean isTypeLink) { Configuration configuration = m_writer.configuration; if (isTypeLink) { return configuration.getText("doclet.Href_Type_Param_Title", classDoc.name()); } else if (classDoc.isInterface()){ return configuration.getText("doclet.Href_Interface_Title", Util.getPackageName(classDoc.containingPackage())); } else if (classDoc.isAnnotationType()) { return configuration.getText("doclet.Href_Annotation_Title", Util.getPackageName(classDoc.containingPackage())); } else if (classDoc.isEnum()) { return configuration.getText("doclet.Href_Enum_Title", Util.getPackageName(classDoc.containingPackage())); } else { return configuration.getText("doclet.Href_Class_Title", Util.getPackageName(classDoc.containingPackage())); } }
/** * Given a class, return the appropriate tool tip. * * @param classDoc the class to get the tool tip for. * @return the tool tip for the appropriate class. */ private String getClassToolTip(ClassDoc classDoc, boolean isTypeLink) { Configuration configuration = ConfigurationImpl.getInstance(); if (isTypeLink) { return configuration.getText("doclet.Href_Type_Param_Title", classDoc.name()); } else if (classDoc.isInterface()){ return configuration.getText("doclet.Href_Interface_Title", Util.getPackageName(classDoc.containingPackage())); } else if (classDoc.isAnnotationType()) { return configuration.getText("doclet.Href_Annotation_Title", Util.getPackageName(classDoc.containingPackage())); } else if (classDoc.isEnum()) { return configuration.getText("doclet.Href_Enum_Title", Util.getPackageName(classDoc.containingPackage())); } else { return configuration.getText("doclet.Href_Class_Title", Util.getPackageName(classDoc.containingPackage())); } }