[JXR-127] Create anchor for classes generated from a Java source file

git-svn-id: https://svn.apache.org/repos/asf/maven/jxr/trunk@1647054 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/maven-jxr/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java b/maven-jxr/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java
index 42e59f3..8357637 100644
--- a/maven-jxr/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java
+++ b/maven-jxr/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java
@@ -65,7 +65,7 @@
  * how the java code will be highlighted with setter methods. Only valid java lines should be passed in since the object
  * maintains state and may not handle illegal code gracefully. The actual system is implemented as a series of filters
  * that deal with specific portions of the java code. The filters are as follows:
- * 
+ *
  * <pre>
  *  htmlFilter
  *    |__
@@ -262,7 +262,7 @@
 
     /**
      * Gets the header attribute of the JavaCodeTransform object
-     * 
+     *
      * @param out the writer where the header is appended to
      * @return String
      */
@@ -328,7 +328,7 @@
 
     /**
      * Gets the footer attribute of the JavaCodeTransform object
-     * 
+     *
      * @param out the writer where the header is appended to
      * @param bottom the bottom text
      * @return String
@@ -642,15 +642,18 @@
         {
             href = this.getHREF( packageName, classType );
             find = classType.getName();
+
+            // build out what the link would be.
+            link = "<a name=\"" + find + "\" href=\"" + href + "\">" + find + "</a>";
         }
         else
         {
             href = this.getHREF( packageName );
             find = packageName;
-        }
 
-        // build out what the link would be.
-        link = "<a href=\"" + href + "\">" + find + "</a>";
+            // build out what the link would be.
+            link = "<a href=\"" + href + "\">" + find + "</a>";
+        }
 
         // use the SimpleWordTokenizer to find all entries
         // that match word. Then replace these with the link
@@ -1301,6 +1304,8 @@
             href.append( "/" );
             href.append( jc.getFilename() );
             href.append( ".html" );
+            href.append('#');
+            href.append( jc.getName() );
         }
 
         return href.toString();