How to generate code samples into javadoc? - java

Recently I have collected lots of api examples for java api(jdk,log4j,etc.), but I've got a problem about inserting the code example into the project's javadoc. People usually use the javadoc and doclet tools to do this, it seems that the source code of the projects maybe changed. For example an example , if I want to add an example to Button, then I may have to add an #example tag in the comment of the Button class...
Is there any tool or way can help me to solve this? to generate javadoc with a lot of collected examples from the Internet,without changing the source code too much~ Thanks a lot!

I find this article . It related to your question. But I agree with Michael Barth. So, why would you want to put commented source code into a comment? Сomments and source code should complement each other.

Related

How to hide the entire design of Xpages like Replace design with option (Hide formulas and LotusScripts)?

I tested on hiding the entire design of Notes and XPages application with Replace Design (Hidden formula and script option). As a result, some XPages processes don't work.
If any tool, please suggest in details.
I did as you suggested in above blog post (Wissel,net). But I encountered same as the last comment of it (Stefan Zehnder). I tested by opening a XPage in which some custom controls as referred to a jar file (custom controls class in xsp package). As a result, I cannot see them in the xPage. Maybe the “composite-file” property in the xsp-config file (in WEB-INF) points to the wrong file or class. If you have any idea, please kindly help.
If I understand your question correctly, then I would suggest looking at the responses to a similar question HERE
Also, the following blog post by Stephan Wissel might give you some ideas?

How to make javadoc.jar take priority over javadoc in sources.jar?

I have a limited selection of original source code overlayed onto decompiled code in a sources jar.
This is great as it gives me easy ability to drill down into the code when debugging however it seems to have a side effect of disabling the javadoc from the associated javadoc.jar from working in eclipse despite me having a separate javadoc.jar file with the javadoc in it.
I assume this happening because eclipse is finding the 'source code' and assumes that all the javadoc is in the source and therefore there is no need to check the javadoc.jar file.
I'd like to be able to tell eclipse (preferably using maven) to not use the sources.jar for javadoc and only use the javadoc.jar. I would still like to use the sources.jar for source code.
I have assumed that eclipse is preferring to display javadoc from sources and may be wrong so please correct me if that is the case.
Also, I may just be doing something simple the wrong way so please let me know if that is the case.
I am hunting for the same thing. I have some source jars I created with jad (and since they are decompiled, they have no JavaDoc in them) and attached as source attachments. I also have the JavaDoc attached. It seems like it is a limitation of Eclipse. It will scrape the JavaDoc from the sources and display it (even if its empty) rather than looking to the JavaDoc. I wish it would notice that the JavaDoc was missing from the source and try the JavaDoc location instead. If I don't find a solution, I'm going to post the question and/or feature request over at the Eclipse site.
One workaround might be to integrate into the java decompiler (like jad) the ability to examine both the source an the javadoc, and put the javadoc back into the source. It would also then have parameter names for methods available too so it could put those back in. Lots of people have suggested this, but I cannot find anyone who has done it.
A couple of caveats. First, jad hasn't been maintained in a long time. The JD-Core/JD-Eclips website has vanished. And I have not found a better Java decompiler than jad. What happened to all the great Java decompiling gurus and solutions? Second, it might be tricky with the "align for debugging" feature to make sure the JavaDoc comments don't take up more room than is available.

Can Java comments be seen by decompiling?

I was wondering if I put comments in my code and when someone tried to decompile it, if they could read the comments that I put?
No, comments are never included as part of the compilation process. They are typically removed in some sort of pre-processing, or first-pass stage.
Nope, comments are discarded by the compiler.
No. And you can verify this by using DJ Java Decompiler, for example. If you also refer to the Java Class File Format, you'll see there's no construct for storing comments.
Comments aren't included in the .class files, so a decompiler won't be able to produce them.

overview/understand architecture codes in eclipse

I have a maven project imported into Eclipse. I'm trying to understand the code pattern (architecture). What is the best way to do this?
will use any UML Eclipse plugin help on this?
will use sequence diagram, help on this?
what plugins should I use?
Please share your opinion.
When I am working with a open source project/codebase I get a high-level view and focus on the core code/logic by checking the package names and structure. I then typically determine how the API works by looking at any example code / documentation contained in the project. If I still need some more help I will draw up some inheritance diagrams, print out interesting classes that I may need to make significant changes to, and try to find more examples of the code being used elsewhere.
I am biased and have been using our recently launched Architexa Eclipse plugin to accomplish the above. I am sure there are others available that do something similar.
I guess you will find some pointers in this SE-Radio podcast: Episode 148: Software Archaeology with Dave Thomas.
Of course, UML can help, but on the other side, it might not as well. For reverse engineering, there is the MoDisco project in Eclipse, which might be useful.

Java: How can I create good looking class docs with Javadoc?

I'd like to create HTML documentation for a Java class library that includes
programming guide information - beyond just a class reference
code examples in the reference doc
collapsible regions
I want it to look well-styled. Something like this:
I think that Javadoc exposes a doclet API that allows other parties to provide doc generation integrated in Javadoc. Is there a doclet option that I can use (for free) that does something a little nicer than the standard javadoc output?
I tried googling for this but no luck.
Suggestions?
Addendum
I found doclet.com but I don't know how to evaluate the options. Recommendations?
In particular, XHtmlDoclet sounds like it wants to address these issues. Anyone used it? I can't get it to work. Also the example offered by the XHTML Doclet guys doesn't look any better than the docs generated from c.1998 javadoc .
Related:
Why does Javadoc generate non-compliant XHTML?
This question got me thinking (ok, Googling) and I stumbled on this set of taglets. Never tried it, but it looks pretty promising.
Perhaps you're thinking of Java doclet API:
http://www.oracle.com/technetwork/java/javase/documentation/index-jsp-135444.html
It appears that you're adding examples and some text. I think it's entirely possible with existing javadocs. The problem will be the content rather than the rendering.
Castor used doclet to ease its config burden. So did EJB 1.0. Take a look at those if you'd like.

Categories