public ClassDoc[] interfaces() { return wrapped.interfaces(); }
public static boolean hasInterface (ClassDoc classDoc) { if (classDoc.interfaces().length > 0) { for (ClassDoc inf : classDoc.interfaces()) { if (inf.qualifiedTypeName().equals(ApiExportor.class.getName())) { return true; } } } return false; }
private static void addInterfaceAndExtendedInterfaces(ClassDoc interfacE, List<ClassDoc> result) { result.add(interfacE); for (ClassDoc extendedInterface : interfacE.interfaces()) { if (!result.contains(extendedInterface)) { result.add(extendedInterface); Docs.addInterfaceAndExtendedInterfaces(extendedInterface, result); } } }
private static void addInterfaceAndExtendedInterfaces(ClassDoc interfacE, List<ClassDoc> result) { result.add(interfacE); for (ClassDoc extendedInterface : interfacE.interfaces()) { if (!result.contains(extendedInterface)) { result.add(extendedInterface); Docs.addInterfaceAndExtendedInterfaces(extendedInterface, result); } } }
public static boolean hasAnnotation (ClassDoc classDoc) { if (classDoc.interfaces().length > 0) { for (AnnotationDesc annotationDesc : classDoc.annotations()) { if (annotationDesc.annotationType().qualifiedTypeName().equals(ApiMapping.class.getName())) { return true; } } } return false; } }
private static void addClassSuperclassesAndInterfaces(ClassDoc clasS, List<ClassDoc> result) { result.add(clasS); ClassDoc superclass = clasS.superclass(); if (superclass != null) { Docs.addClassSuperclassesAndInterfaces(superclass, result); } for (ClassDoc interfacE : clasS.interfaces()) { Docs.addInterfaceAndExtendedInterfaces(interfacE, result); } }
private static void addClassSuperclassesAndInterfaces(ClassDoc clasS, List<ClassDoc> result) { result.add(clasS); ClassDoc superclass = clasS.superclass(); if (superclass != null) { Docs.addClassSuperclassesAndInterfaces(superclass, result); } for (ClassDoc interfacE : clasS.interfaces()) { Docs.addInterfaceAndExtendedInterfaces(interfacE, result); } }
/** * This method creates and binds the umlClass provided with the interfaces it implements. * * @param classDoc is the non-null description of the umlClass * @param umlClass is the non-null model class created */ private void createSuperInetrfaces(ClassDoc classDoc, Classifier umlClass) { ClassDoc[] interfacesDoc; Classifier superClass; interfacesDoc = classDoc.interfaces(); for (int i = 0; i < interfacesDoc.length; i++) { superClass = generateType( interfacesDoc[ i ] ); factory.constructGeneralization( umlClass, superClass ); } }
public boolean matches(ClassDoc cd) { // if it's the interface we're looking for, match if(cd.isInterface() && pattern.matcher(cd.toString()).matches()) return true; // for each interface, recurse, since classes and interfaces // are treated the same in the doclet API for (ClassDoc iface : cd.interfaces()) if(matches(iface)) return true; // recurse on supeclass, if available return cd.superclass() == null ? false : matches(cd.superclass()); }
/** * For the interface passed get the interfaces which it extends, and then * put this interface in the sub-interface list of those interfaces. Do it * recursively. If a interface doesn't have super-interface just attach * that interface in the list of all the baseinterfaces. * * @param cd Interface under consideration. */ private void processInterface(ClassDoc cd) { ClassDoc[] intfacs = cd.interfaces(); if (intfacs.length > 0) { for (int i = 0; i < intfacs.length; i++) { if (!add(subinterfaces, intfacs[i], cd)) { return; } else { processInterface(intfacs[i]); // Recurse } } } else { // we need to add all the interfaces who do not have // super-interfaces to baseinterfaces list to traverse them if (!baseinterfaces.contains(cd)) { baseinterfaces.add(cd); } } }
/** * An enhanced version of {@link ClassDoc#methods(boolean)} which optionally also includes <i>inherited</i> * methods. * * @param filter Specify {@code true} to filter according to the specified access modifier option; see * {@link ClassDoc#methods(boolean)} * @param includeInherited Whether to add the superclasses' and the implemented interfaces' methods after the * class's methods */ public static MethodDoc[] methods(final ClassDoc classDoc, boolean filter, boolean includeInherited) { if (!includeInherited) return classDoc.methods(filter); List<MethodDoc> result = new ArrayList<MethodDoc>(); result.addAll(Arrays.asList(classDoc.methods(filter))); ClassDoc superclassDoc = classDoc.superclass(); if ( superclassDoc != null && !"org.apache.tools.ant.ProjectComponent".equals(superclassDoc.qualifiedName()) && !"org.apache.tools.ant.Task".equals(superclassDoc.qualifiedName()) ) result.addAll(Arrays.asList(Docs.methods(superclassDoc, filter, true))); for (ClassDoc interfaceDoc : classDoc.interfaces()) { result.addAll(Arrays.asList(Docs.methods(interfaceDoc, filter, true))); } return result.toArray(new MethodDoc[result.size()]); }
/** * @return Whether <var>b</var> is <var>a</var>, or an interface or superclass of <var>a</var> */ public static boolean isSubclassOf(ClassDoc a, ClassDoc b) { if (a == b) return true; for (ClassDoc i : a.interfaces()) { if (Docs.isSubclassOf(i, b)) return true; } ClassDoc s = a.superclass(); return s != null && Docs.isSubclassOf(s, b); }
public boolean matches(ClassDoc cd) { // if it's the interface we're looking for, match if(cd.isInterface() && pattern.matcher(cd.toString()).matches()) return true; // for each interface, recurse, since classes and interfaces // are treated the same in the doclet API for (ClassDoc iface : cd.interfaces()) { if(matches(iface)) return true; } // recurse on supeclass, if available if(cd.superclass() != null) return matches(cd.superclass()); return false; }
/** * An enhanced version of {@link ClassDoc#methods(boolean)} which optionally also includes <i>inherited</i> * methods. * * @param filter Specify {@code true} to filter according to the specified access modifier option; see * {@link ClassDoc#methods(boolean)} * @param includeInherited Whether to add the superclasses' and the implemented interfaces' methods after the * class's methods */ public static MethodDoc[] methods(final ClassDoc classDoc, boolean filter, boolean includeInherited) { if (!includeInherited) return classDoc.methods(filter); List<MethodDoc> result = new ArrayList<MethodDoc>(); result.addAll(Arrays.asList(classDoc.methods(filter))); ClassDoc superclassDoc = classDoc.superclass(); if ( superclassDoc != null && !"org.apache.tools.ant.ProjectComponent".equals(superclassDoc.qualifiedName()) && !"org.apache.tools.ant.Task".equals(superclassDoc.qualifiedName()) ) result.addAll(Arrays.asList(Docs.methods(superclassDoc, filter, true))); for (ClassDoc interfaceDoc : classDoc.interfaces()) { result.addAll(Arrays.asList(Docs.methods(interfaceDoc, filter, true))); } return result.toArray(new MethodDoc[result.size()]); }
/** * @return Whether {@code b} is {@code a}, or an interface or superclass of {@code a} */ public static boolean isSubclassOf(ClassDoc a, ClassDoc b) { if (a == b) return true; for (ClassDoc i : a.interfaces()) { if (Docs.isSubclassOf(i, b)) return true; } ClassDoc s = a.superclass(); return s != null && Docs.isSubclassOf(s, b); }
/** * Finds a methods definition on any ancestor, be it interface or class. * * @param methodDoc The element to get the inherited member of * @return null if there is no ancestor. */ private static MethodDoc getAncestor(MethodDoc methodDoc) { // only provides parent class overrides, but does not include interfaces if (methodDoc.overriddenMethod() != null) { return methodDoc.overriddenMethod(); } // search for method on interfaces by looping through. I arbitrarily decided that // the first match wins in case there are multiple. One could consider joining the // various documentations... for (ClassDoc intf : methodDoc.containingClass().interfaces()) { final MethodDoc intfMethod = findInterfaceMethod(intf, methodDoc); if (intfMethod != null) { return intfMethod; } } return null; }
private void mapClass() { addMembers(mappingClass); ClassDoc[] interfaces = mappingClass.interfaces(); for (int i = 0; i < interfaces.length; i++) { String locallevel = level + 1; ClassMembers cm = new ClassMembers(interfaces[i], locallevel); cm.mapClass(); } if (mappingClass.isClass()) { ClassDoc superclass = mappingClass.superclass(); if (!(superclass == null || mappingClass.equals(superclass))) { ClassMembers cm = new ClassMembers(superclass, level + "c"); cm.mapClass(); } } }
private void mapClass() { addMembers(mappingClass); ClassDoc[] interfaces = mappingClass.interfaces(); for (int i = 0; i < interfaces.length; i++) { String locallevel = level + 1; ClassMembers cm = new ClassMembers(interfaces[i], locallevel); cm.mapClass(); } if (mappingClass.isClass()) { ClassDoc superclass = mappingClass.superclass(); if (!(superclass == null || mappingClass.equals(superclass))) { ClassMembers cm = new ClassMembers(superclass, level + "c"); cm.mapClass(); } } }
/** * Add method information. * * @param method the method to be documented * @param dl the content tree to which the method information will be added */ private void addMethodInfo(MethodDoc method, Content dl) { ClassDoc[] intfacs = method.containingClass().interfaces(); MethodDoc overriddenMethod = method.overriddenMethod(); // Check whether there is any implementation or overridden info to be // printed. If no overridden or implementation info needs to be // printed, do not print this section. if ((intfacs.length > 0 && new ImplementedMethods(method, this.configuration).build().length > 0) || overriddenMethod != null) { MethodWriterImpl.addImplementsInfo(this, method, dl); if (overriddenMethod != null) { MethodWriterImpl.addOverridden(this, method.overriddenType(), overriddenMethod, dl); } } }
private void printMethodInfo( MethodDoc method ) { ClassDoc[] intfacs = method.containingClass().interfaces(); MethodDoc overriddenMethod = method.overriddenMethod(); // Check whether there is any implementation or overridden info to be // printed. If no overridden or implementation info needs to be // printed, do not print this section. if( (intfacs.length > 0 && new ImplementedMethods( method, this.configuration ).build().length > 0) || overriddenMethod != null ) { printMemberDetailsListStartTag(); dd(); printTagsInfoHeader(); MethodWriterImpl.printImplementsInfo( this, method ); if( overriddenMethod != null ) { MethodWriterImpl.printOverridden( this, method.overriddenType(), overriddenMethod ); } printTagsInfoFooter(); ddEnd(); } }