Last updated March 29, 2011 23:09, by elygre


The FluentApi plugin provides Method Chaining for bean setters, basically what Martin Fowler refers to as FluentInterface.

Using standard javabeans setters, you would use this:

   USAddress address = new USAddress();
   address.setName( name );
   address.setStreet( street );
   address.setCity( city );
   address.setState( state );
   address.setZip( new BigDecimal( zip ) );

With the FluentApi plugin, you may also use this:

   USAddress address = new USAddress()
 			.withZip(new BigDecimal(zip));


Sample ant build.xml:

 <taskdef name="xjc" classname="">
       <pathelement path="/path/to/jaxb-xjc.jar"/>
       <pathelement path="/path/to/jaxb-fluent-api-2.2.jar" />
    <arg value="-Xfluent-api" />

Getting the plugin

The plugin is available in the central Maven repository, under