public static void insertXmlDocumentationAnnotationsFor ( final Node aNode , final SortedMap < ClassLocation , JavaDocData > classJavaDocs , final SortedMap < FieldLocation , JavaDocData > fieldJavaDocs , final SortedMap < MethodLocation , JavaDocData > methodJavaDocs , final JavaDocRenderer renderer ) { JavaDocData javaDocData = null ; SortableLocation location = null ; // Insert the documentation annotation into the current Node. final ClassLocation classLocation = DomHelper . getClassLocation ( aNode , classJavaDocs . keySet ( ) ) ; if ( classLocation != null ) { javaDocData = classJavaDocs . get ( classLocation ) ; location = classLocation ; } else { final FieldLocation fieldLocation = DomHelper . getFieldLocation ( aNode , fieldJavaDocs . keySet ( ) ) ; if ( fieldLocation != null ) { javaDocData = fieldJavaDocs . get ( fieldLocation ) ; location = fieldLocation ; } else { final MethodLocation methodLocation = DomHelper . getMethodLocation ( aNode , methodJavaDocs . keySet ( ) ) ; if ( methodLocation != null ) { javaDocData = methodJavaDocs . get ( methodLocation ) ; location = methodLocation ; } } } // We should have a JavaDocData here. if ( javaDocData == null ) { final String nodeName = aNode . getNodeName ( ) ; String humanReadableName = DomHelper . getNameAttribute ( aNode ) ; if ( humanReadableName == null && nodeName . toLowerCase ( ) . endsWith ( "enumeration" ) ) { humanReadableName = "enumeration#" + getValueAttribute ( aNode ) ; } throw new IllegalStateException ( "Could not find JavaDocData for XSD node [" + humanReadableName + "] with XPath [" + DomHelper . getXPathFor ( aNode ) + "]" ) ; } // Add the XML documentation annotation. final String processedJavaDoc = renderer . render ( javaDocData , location ) . trim ( ) ; DomHelper . addXmlDocumentAnnotationTo ( aNode , processedJavaDoc ) ; }
Processes the supplied DOM Node inserting XML Documentation annotations if applicable .