/** * 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; }
Input inheritedSearchInput = input.copy(); inheritedSearchInput.isInheritDocTag = false; if (input.method.overriddenMethod() != null) { inheritedSearchInput.method = input.method.overriddenMethod(); output = search(inheritedSearchInput); output.isValidInheritDocTag = true;
/** * 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(); } }
inheritedSearchInput.isInheritDocTag = false; if (input.element instanceof MethodDoc) { MethodDoc overriddenMethod = ((MethodDoc) input.element).overriddenMethod(); if (overriddenMethod != null) { inheritedSearchInput.element = overriddenMethod;