Here's an example of JavaDoc for JAX-RS:
/**
* This is our order resource
*/
@Path("/order")
@Produces("application/xml")
public class Order {
/**
* Gets a single order
* @param orderKey the order key
* @return the order if found
* @HTTP 404 order not found
*/
@GET
@Path("{id}")
public Order getOrder(@PathParam("id") String orderKey){…}
/**
* Gets every order
* @return every order
* @returnWrapped com.foo.OrderList
*/
@GET
public Response getOrders(){…}
/**
* Uploads an order
* @param order the order to upload
* @inputWrapped com.foo.Order
*/
@POST
public void postOrder(String orderAsString){…}
}
Once you have downloaded our doclets jar, simply use the following ant task:
<path id="compile.classpath">
<pathelement location=".../jax-doclets-0.10.0.jar"/>
</path>
<target name="jax-doc-jaxrs" description="Generate JAX-RS documentation">
<javadoc classpathref="compile.classpath" sourcepath="${src.dir}"
destdir="${build.dir}/jaxrsdocs/" extdirs="${lib.dir}"
doclet="com.lunatech.doclets.jax.jaxrs.JAXRSDoclet"
docletpathref="compile.classpath">
<link href="../jaxbdocs/"/>
</javadoc>
</target>
<target name="jax-doc-jaxb" description="Generate JAXB documentation">
<javadoc classpathref="compile.classpath" sourcepath="${src.dir}"
destdir="${build.dir}/jaxbdocs/" extdirs="${lib.dir}"
doclet="com.lunatech.doclets.jax.jaxb.JAXBDoclet"
docletpathref="compile.classpath">
</javadoc>
</target>
<target name="jax-doc-jpa" description="Generate JPA documentation">
<javadoc classpathref="compile.classpath" sourcepath="${src.dir}"
destdir="${build.dir}/jpadocs/" extdirs="${lib.dir}"
doclet="com.lunatech.doclets.jax.jpa.JPADoclet"
docletpathref="compile.classpath">
</javadoc>
</target>
Or using Maven:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<reportSets>
<reportSet>
<id>jaxb</id>
<configuration>
<doclet>com.lunatech.doclets.jax.jaxb.JAXBDoclet</doclet>
<docletArtifacts>
<docletArtifact>
<groupId>com.lunatech.jax-doclets</groupId>
<artifactId>doclets</artifactId>
<version>0.10.0</version>
</docletArtifact>
</docletArtifacts>
<destDir>jaxbdocs</destDir>
</configuration>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
<reportSet>
<configuration>
<doclet>com.lunatech.doclets.jax.jaxrs.JAXRSDoclet</doclet>
<docletArtifacts>
<docletArtifact>
<groupId>com.lunatech.jax-doclets</groupId>
<artifactId>doclets</artifactId>
<version>0.10.0</version>
</docletArtifact>
</docletArtifacts>
<destDir>jaxrsdocs</destDir>
<links>
<link>../jaxbdocs/</link>
</links>
</configuration>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
<reportSet>
<id>jpa</id>
<configuration>
<doclet>com.lunatech.doclets.jax.jpa.JPADoclet</doclet>
<docletArtifacts>
<docletArtifact>
<groupId>com.lunatech.jax-doclets</groupId>
<artifactId>doclets</artifactId>
<version>0.10.0</version>
</docletArtifact>
</docletArtifacts>
<destDir>jpadocs</destDir>
</configuration>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
Copyright © 2005-2012, Lunatech Labs B.V. All rights reserved.