Sunday, November 7, 2010

Adding XML to Javadoc comments

Copied from http://blog.smartkey.co.uk/2008/08/adding-xml-to-javadoc-comments/


Problems with adding comments

Inserting code snippets into Javadoc comments that read well in both the source code and the HTML files produced by Javadoc can be a very fiddly process. Inserting XML snippets into your documentation can make this trickier still. Read on to discover a simple technique that works equally well with both Java and XML code snippets in your Javadocs.


....

/**
* <p>This class should be used as follows:</p>
* <pre>
* {@code
* <bean>
* <property name="propName" value="propValue"/>
* </bean>
* }
* </pre>
*/
public class MockObject {
...

}