tags:

views:

257

answers:

1

Question from a C-guy who has to work with some java code that is connected to my C-code via JNI.

I have to work on the build-system, and I'm trying to change that from a shell-script to a proper makefile. For the C-part that's easy, but the java side somehow involves xdoclet stuff.

I haven't yet found out what xdoclet is all about, and I want to understand it all.

I did my Google research, but I have no idea what that thing does. For me it seems like you only have a chance to understand the official documentation if you're already familiar with the problem and you have 10 years of java work under your belt.

Could you please - for dummies - explain what does xdoclet does?

Btw - also I've mentioned C. I'm into object oriented programming as well. There is no need to explain the basics of classes or inheritance (if required to understand xdoclet) to me.

+4  A: 

The 10000 foot view of XDoclet is that it's a code generation engine. IMO, the interesting thing about XDoclet is how it does what it does, as opposed to what it does.

There is a tool called javadoc that takes annotation in source code comments and generates html documentation with it. This is the classic example of what javadoc was originally designed to produce. In an effort to support different output formats, the authors of javadoc made it plugable -- you can write "doclets" that plugin into the javadoc engine. This allows them to leverage the same source code parser, and emit different documentation output.

XDoclet is a clever hack that uses this engine to do code generation instead of documentation generation.

An example of usage would be: the developer manually writes a class that contains business logic, adds a few xdoclet annotations to the javadoc, and xdoclet generates additional code that provides transactional integrity.

EDIT: As erickson notes, Java 5 added support for annotations as a language feature that can be processed directly by the compiler. As a result, the functionality that XDoclet used to provide can now be performed directly by the Annotation Processing Tool (apt) that ships with the JDK. Because of this XDoclet is now generally considered to be obsolete.

Sean Reilly
Might want to discuss how XDoclet is sort of "annotations-before-annotations-existed"... i.e., today people do what they used to do with xdoclet using standard annotations.
erickson
Okay - I didn't understood anything. From what I understood: You write java-doc style documentation (without code) and xdoclet generates the class for you. Is it that?
Nils Pipenbrinck
@Nils: Almost. You write java-doc style documentation with code, and xdoclet generates more code that does tedious things for you. And as @ericson mentions, it's now considered to be out-of-date technology
Sean Reilly