qr code generator javascript XDoclet: Building your own tags in Java

Generate QR Code ISO/IEC18004 in Java XDoclet: Building your own tags

9.1.2 XDoclet: Building your own tags
Print QR Code ISO/IEC18004 In Java
Using Barcode encoder for Java Control to generate, create Quick Response Code image in Java applications.
www.OnBarcode.com
QR Code 2d Barcode Scanner In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
XDoclet works by defining its own set of custom tags. More precisely, each XDoclet module (of which there are quite a few) defines its own set of tags. There are XDoclet modules for handling EJBs, Struts, WebWork, JDO, and most importantly for our purposes, Hibernate. Instead of generating HTML files for documentation purposes, XDoclet can generate any sort of files, using a JSP-like template syntax. The generated files can be HTML, XML, Java, C#, or whatever the template author wants. The following uses the prebuilt Hibernate templates to generate the mapping XML files for you:
PDF-417 2d Barcode Creation In Java
Using Barcode generation for Java Control to generate, create PDF-417 2d barcode image in Java applications.
www.OnBarcode.com
Barcode Generation In Java
Using Barcode maker for Java Control to generate, create Barcode image in Java applications.
www.OnBarcode.com
Hibernating with XDoclet
QR Code JIS X 0510 Generator In Java
Using Barcode creation for Java Control to generate, create QR Code ISO/IEC18004 image in Java applications.
www.OnBarcode.com
Drawing UPC Code In Java
Using Barcode drawer for Java Control to generate, create UPC Code image in Java applications.
www.OnBarcode.com
/** * @hibernate.class table="events" */ public class Event implements Serializable { /** * This tag marks the primary key field * and column in database. * @hibernate.id generator-class="native" column="uid" */ public Long getId() { return id; } }
EAN13 Encoder In Java
Using Barcode printer for Java Control to generate, create European Article Number 13 image in Java applications.
www.OnBarcode.com
Making MSI Plessey In Java
Using Barcode encoder for Java Control to generate, create MSI Plessey image in Java applications.
www.OnBarcode.com
Here you see a Hibernate tag called @hibernate.class. This marks this class as a Hibernate persistent class. Normally you would have to manually write an Event.hbm.xml file. Instead, when XDoclet processes this file, it will generate a basic Event.hbm.xml file for you. One of the new things you see here is the table attribute. Typically, JavaDoc just parses the text immediately after the tag. XDoclet needs more specific information to work with, so tags can include attributes, such as the table attribute you see here. This allows you to tell XDoclet what table Event maps to. In fact, with just the previous lines of code XDoclet will generate a file that looks like the one shown in listing 9.1. Listing 9.1 Generated Event.hbm.xml
QR Code JIS X 0510 Reader In Java
Using Barcode scanner for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Paint QR Code ISO/IEC18004 In Visual Basic .NET
Using Barcode drawer for .NET Control to generate, create QR Code image in .NET applications.
www.OnBarcode.com
< xml version="1.0" > <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class Generates the class name name="com.manning.hq.ch09.Event" table="events" Writes out the event dynamic-update="false" table attribute dynamic-insert="false" > <id Extracts the id property name="id"
ECC200 Reader In C#
Using Barcode recognizer for Visual Studio .NET Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
Making EAN-13 Supplement 5 In None
Using Barcode encoder for Font Control to generate, create GS1 - 13 image in Font applications.
www.OnBarcode.com
Essential XDoclet
Printing EAN / UCC - 13 In None
Using Barcode generator for Software Control to generate, create UCC.EAN - 128 image in Software applications.
www.OnBarcode.com
Read Barcode In C#.NET
Using Barcode Control SDK for VS .NET Control to generate, create, read, scan barcode image in .NET applications.
www.OnBarcode.com
column="uid" type="java.lang.Long" >
EAN-13 Supplement 5 Reader In C#
Using Barcode scanner for .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
Barcode Encoder In None
Using Barcode encoder for Software Control to generate, create Barcode image in Software applications.
www.OnBarcode.com
Determines correct field type
Creating PDF-417 2d Barcode In Java
Using Barcode creation for BIRT reports Control to generate, create PDF 417 image in BIRT reports applications.
www.OnBarcode.com
Drawing Code39 In None
Using Barcode creation for Font Control to generate, create ANSI/AIM Code 39 image in Font applications.
www.OnBarcode.com
<generator class="native"> </generator> </id> <!-To add non-XDoclet property mappings, create a file named hibernate-properties-Event.xml containing the additional properties and place it in your merge dir. --> </class> </hibernate-mapping>
PDF-417 2d Barcode Creator In VB.NET
Using Barcode generator for .NET Control to generate, create PDF-417 2d barcode image in Visual Studio .NET applications.
www.OnBarcode.com
Code 39 Extended Scanner In Visual C#
Using Barcode decoder for VS .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
With two brief lines of XDoclet comments, you have generated an 18line file (excluding whitespace and comments). In addition, most of the necessary class and field type information has been gathered from the source file itself, without you having to specify it. The fully qualified name of the class (com.manning.hq.ch09.Event) is included, as well as the Long field id.
9.1.3 Installing XDoclet
Having covered some of the basic details of how XDoclet works, let s dig down a little deeper and work on some examples. You first have to get a copy of XDoclet, so head to its home page at http://xdoclet. sourceforge.net/xdoclet/index.html. Choose the download/installation link from the left menu, and then select the SourceForge download page. At the time of this writing, the latest stable version is 1.2.3; support for Hibernate 3 has been added. Select the bin version, which should be the most complete package; it will be named something like xdoclet-bin-1.2.3.zip. After getting a distribution, extract it to your applications directory. When you ve finished, take a look; the directory should be named something like /applications/xdoclet-1.2.3. You should see at least three directories: docs, lib, and samples. The docs directory contains the
Hibernating with XDoclet
documentation for the project, which is mostly a duplicate of the website, including the JavaDocs. The samples directory contains some code samples of XDoclet in action. And finally, the lib directory contains all the XDoclet JAR files and XDoclet s dependencies. If you want a complete list of all the XDoclet tags, check out the tag reference by opening up docs/index.html and choosing the tag reference link for Hibernate from the left menu. That s all there is to the install. In the next section, you ll integrate XDoclet into your Ant build file.
Copyright © OnBarcode.com . All rights reserved.