I want to show part of method body in its documentation (JavaDoc).
For example:
/**
* The algorithm contains steps:
* @showMethodBody
*/
public void algorithmX(int coordinateX) {
makeStep1();
if (coordinateX == TOP) {
makeStep2();
}
}
Which should produce documentation like:
The algorithm contains steps: makeStep1(); if (coordinateX == TOP) { makeStep2(); }
I know that such documentation is a bit silly and it's not in natural language. But the best thing is that it never be out of date.
So general concepts could be described in natural language, but crucial elements may be copied directly from source code. As you see source code could be informative for not programmer also. And here is my question:
Question:
How to copy (show) part or whole method body inside method's documentation?
Now I'm using JavaDoc, but I can also use any other tool. I can also add some pointers (annotation or special comments) in source code if it will help.