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.
Related
I found a few code examples, but I don't know with which JNA versions I can use which methods. I did only find snippets, where classes were missing and I wasn't able to import them.
I would like to know which JNA version I should use and how to get a screenshot as BufferedImage.
A list of required imports would also be great.
It looks like there are several examples at this link. I'll discuss one below (#3) for discussion purposes, but you may find one of the other examples more applicable to your situation and hopefully this answer will help you understand the process.
Before the example, I will answer your question "which JNA versions"... you should use the latest version in almost all cases. JNA is a user-supported library, and the core JNA code doesn't change much but each new version adds more user-contributed mappings to native functions. Note their FAQ question, "JNA is missing function XXX in its platform library mappings" and the answer, "No, it's not, it's just waiting for you to add it :)". If the mapping you need is not in JNA, you can simply add it using the example provided, for your immediate needs. Better yet, contribute your mapping to the JNA project so that the next person in your situation will benefit from the work you've done!
Now, example #3 from the link takes a screenshot of the entire screen and returns it as a BufferedImage object. The full source code for that example shows all the imports you will need, most from JNA's WinGDI class.
If you scroll to the bottom of the class you may also see that the authors have extended two JNA platform interface contributions with mappings that aren't in JNA (or weren't in 2010 when that code was written). You will have to do similar mappings (and perhaps contribute them to their respective JNA classes when you're done).
I am working on a team for a class, and we have written a very large amount of code. Luckily for us, we were diligent in adding javadoc annotations to everything, so we should be able to create the documentation very easily. For the class however, we are required to have all of our documentation on a wikispace page.
Some of the pages will be javadoc, some of them will be plain text. Is there an easy way to convert javadocs to wiki pages, or embed javadocs into wiki pages? Thanks!
I haven't tried this myself, but maybe doxygen(http://www.doxygen.nl/) in conjunction with this tool (https://code.google.com/p/doxy2wiki/) may be able to solve your problem.
I need to read and write some data on .mdb Access file and over the web I found the Jackcess library that that does exactly that.
Unfortunately I could't find any documentation to use that. On the library website there are a couple of examples, but no real documentation. Can anyone tell me if there's some sort of documentation somewhere?
The javadoc is intended to be fairly explanatory. The primary classes would be Database and Table. The library is also heavily unit tested, so you can dig into the unit test code to see many examples. There isn't currently a great "getting started" document. It has been discussed before, but, unfortunately no one has picked up the ball on actually writing it. That said, the help forum is actively monitored.
UPDATE:
There is now a cookbook, which is the beginnings of a more comprehensive user-level documentation.
You can use jackcess-orm that use DAO pattern and POJO with annotations.
I am creating a tool that will check dynamically generated XHTML and validate it against expected contents.
I need to confirm the structure is correct and that specific attributes exist/match. There may be other attributes which I'm not interested in, so a direct string comparison is not suitable.
One way of validating this is with XPath, and I have implemented this already, but I would also like something less verbose - I want to be able to use CSS Selectors, like I can with jQuery, but on the server - within CFML code - as opposed to on the client.
Is there a CFML or Java library that allows me to use CSS Selectors against an XHTML string?
I've just released an open source project which is a W3C CSS Selectors Level 3 implementation in Java. Please give it a try. I was looking for the same thing and decided to implement my own engine. It's inspired by the code in WebKit etc.
http://github.com/chrsan/css-selectors/tree
I don't know of a Java library itself, but there is a Ruby library called Hpricot that does exactly what you're looking for. In conjunction with the Ruby implementation on the Java platform, JRuby, it should be relatively straightforward to call Ruby methods from your Java code (using BSF, JSR-222 Scripting APIs, or an internal API).
Are you using Coldfusion 8? Coldfusion 8, being based on Java 6, supports JSR-222 Scripting APIs "javax.scripting".
Take a look at this blog entry on embedding PHP within CFML. You should be able to do the same with Ruby. There is ZIP file example code linked from this blog posting, and if you crack open the CFML, you'll see a good example of embedding Ruby within CFML.
Although it might take a bit of work to make all the pieces work together, but with a bit of investment, it should give you the robust parsing/CSS selector querying that you're looking for.
Hpricot is definetly a fantastic solution if the JRuby-route is open to you.
Wrt. XPath being the "correct" way to access XML documents... sorry but this is rubbish. There are numerous ways to access elements of an XML document: DOM traversal, XPath, XQuery, CSS selectors to name a few. XPath is certainly popular but CSS selectors are very very powerful, assuming your XML document has HTML semantics.
If you can use PHP within your CFML (as mentioned above), you could take advantage of this excellent "jQuery for PHP" library, phpQuery
Full CSS selector support, manipulation functions, traversing, etc. It should work great for what you need.
Hope it helps.
There is a theoretical difference between the server and client. To a web browser, the document is a living DOM hierarchy. To your server code it's merely an XML document of whatever type. XPath is the "correct" way to access elements of an XML document.
So unless you have a serious performance problem with your current XPath solution, or it doesn't actually work correctly, I suggest you stick with it. Trying something too clever brings the risk of breaking something that's working.
If you find the XPath to be too verbose and ugly to leave sitting around, or want more power to re-use the tool in different cases, or just can't resist trying to do something clever, then you could try writing a utility that compiles a given CSS selector into an XPath. You could then call this in one line whenever you needed.
it may be easier to use cQuery.com - cQuery.com is an API based 'Content Query Engine' to extract content from live websites by using CSS.
You can using it programatically in you application.
I'm working on a project where we're doing a lot of remote object transfer between a Java service and clients written in other various languages. Given our current constraints I've decided to see what it would take to generate code based on an existing Java class. Basically I need to take a .class file (or a collection of them) parse the bytecode to determine all of the data members and perhaps getters/setters and then write something that can output code in a different language to create a class with the same structure.
I'm not looking for standard decompilers such as JAD. I need to be able to take a .class file and create an object model of its data members and methods. Is this possible at all?
I've used BCEL and find it really quite awkward. ASM is much better. It very extensively uses visitors (which can be a little confusing) and does not create an object model. Not creating an object model turns out to be a bonus, as any model you do want to create is unlikely to look like a literal interpretation of all the data.
I have used BCEL in the past and it was pretty easy to use. It was a few years ago so there may be something better now.
Apache Jakarta BCEL
From your description, it sounds like simple reflection would suffice. You can discover all of the static structure of the class, as well as accessing the fields of a particular instance.
I would only move on to BCEL if you are trying to translate method instructions. (And if that's what you're trying to automate, good luck!)
I'm shocked that no one has mentioned ASM yet. It's the best bytecode library your money can buy. Well, ok it's free.
JAD is a java decompiler that doesn't allow programmatic access. It isn't readily available anymore, and probably won't work for newer projects with Java7 bytecodes.
I think javassist might help you too.
http://www.jboss.org/javassist/
I have never had the need of using it, but if you give it a try, would you let us know your comments about it?
Although I think it is more for bytecode manipulation than .class inspection.