Skip to Content
Java Extreme Programming Cookbook
book

Java Extreme Programming Cookbook

by Eric M. Burke, Brian M. Coyner
March 2003
Intermediate to advanced
288 pages
7h 4m
English
O'Reilly Media, Inc.
Content preview from Java Extreme Programming Cookbook

Creating an XDoclet xdoclet.xml File

Problem

You need to create a new XDoclet xdoclet.xml file for a custom code generator.

Solution

Mark up your sub tasks with @ant.element tags and your tag handler classes with @xdoclet.taghandler tags. Add an Ant target to your buildfile that executes XDoclet’s template subtask with XDoclet’s xdoclet-xml.xdt template file.

Discussion

XDoclet 1.2 code generators require a deployment descriptor named xdoclet.xml. This file defines the namespace for an XDoclet tag handler class used in a template file, and defines the subtasks that are valid for a single XDoclet task. The file must exist in the meta-inf directory of your code generator’s JAR file. The JAR file is known as an XDoclet module. Modules are discussed in more detail in the next recipe.

Example 9-14 shows how to mark up an XDoclet subtask. The only tag needed is an @ant.element tag. This tag defines two mandatory attributes: name and parent. The name attribute specifies the subtask name to use in the Ant buildfile. The parent attribute specifies the Ant XDoclet task that is allowed to execute the subtask. Remember that we do not need a subclass of xdoclet.DocletTask; therefore, we use DocletTask as the parent.

Example 9-14. Marked-up XDoclet subtask

/**
 * @ant.element
 *     name="junitperf"
 *     parent="xdoclet.DocletTask"
 *
 * @author Brian M. Coyner
 */

Example 9-15 shows how to mark up an XDoclet tag handler class. The only tag needed is an @xdoclet.taghandler tag with the mandatory attribute namespace ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Java Thread Programming

Java Thread Programming

Paul Hyde
Java Swing

Java Swing

Robert Eckstein, Marc Loy, Dave Wood
Distributed Computing in Java 9

Distributed Computing in Java 9

Raja Malleswara Rao Malleswara Rao Pattamsetti
Java 9 High Performance

Java 9 High Performance

Mayur Ramgir, Nick Samoylov

Publisher Resources

ISBN: 0596003870Catalog PageErrata