<?xml version="1.0"?>
<rss version="2.0">
<channel>
  <title>Jason Menard&#039;s Weblog - Articles category</title>
  <link>http://www.jmenard.com/blog/categories/articles/</link>
  <description>java, software engineering, and all that jazz</description>
  <language>en</language>
  <copyright>Jason Menard</copyright>
  <lastBuildDate>Sun, 01 Jul 2007 02:44:00 GMT</lastBuildDate>
  <generator>Pebble (http://pebble.sourceforge.net)</generator>
  <docs>http://backend.userland.com/rss</docs>
  
  
  <item>
    <title>Interview with Harshad Oak, author of Pro Jakarta Commons</title>
    <link>http://www.jmenard.com/blog/2004/06/17/interview_with_harshad_oak_author_of_pro_jakarta_commons.html</link>
    
      
        <description>
          &lt;p&gt; &lt;a href=&#034;http://www.amazon.com/exec/obidos/tg/detail/-/1590592832/jr_bunk-20&#034;&gt;&lt;img hspace=&#034;8&#034; border=&#034;0&#034; align=&#034;left&#034; alt=&#034;&#034; src=&#034;http://images.amazon.com/images/P/1590592832.01.MZZZZZZZ.jpg&#034; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I recently had the opportunity to conduct an &lt;a href=&#034;http://www.javaranch.com/journal/200406/Journal200406.jsp#a4&#034;&gt;interview with Harshad Oak&lt;/a&gt;, author of the &lt;a href=&#034;http://www.apress.com&#034;&gt;APress&lt;/a&gt; title &lt;em&gt;&lt;a href=&#034;http://www.amazon.com/exec/obidos/ASIN/1590592832/jr_bunk-20&#034;&gt;Pro Jakarta Commons&lt;/a&gt;&lt;/em&gt;.  It&#039;s a pretty good book and definitely worth checking out.  Eventually I&#039;ll get around to writing a review for it.  Harshad came up with some excellent answers to the questions and I want to take this opportunity to thank him for taking part in this.  The interview is published in the &lt;a href=&#034;http://www.javaranch.com/journal/200406/Journal200406.jsp&#034;&gt;June 2004 edition&lt;/a&gt; of the &lt;a href=&#034;http://www.javaranch.com/newsletter.jsp&#034;&gt;JavaRanch Journal&lt;/a&gt;.&lt;/p&gt;
        </description>
      
      
    
    
    
    <category>Articles</category>
    
    <comments>http://www.jmenard.com/blog/2004/06/17/interview_with_harshad_oak_author_of_pro_jakarta_commons.html#comments</comments>
    <guid isPermaLink="true">http://www.jmenard.com/blog/2004/06/17/interview_with_harshad_oak_author_of_pro_jakarta_commons.html</guid>
    <pubDate>Thu, 17 Jun 2004 13:36:08 GMT</pubDate>
  </item>
  
  <item>
    <title>JavaRanch Journal Article published on BeanUtils, Digester, and Type Conversion</title>
    <link>http://www.jmenard.com/blog/2004/06/17/javaranch_journal_article_published_on_beanutils_digester_and_type_conversion.html</link>
    
      
        <description>
          &lt;p&gt;My previous blog entry, &lt;a href=&#034;http://radio.javaranch.com/channel/jason/2004/06/09/1086797433000.html&#034;&gt;BeanUtils, Digester, and Type Conversion&lt;/a&gt;, has just been published as an article in the latest &lt;a href=&#034;http://www.javaranch.com/journal/200406/Journal200406.jsp#a2&#034;&gt;JavaRanch Journal&lt;/a&gt;.&lt;/p&gt;
        </description>
      
      
    
    
    
    <category>Articles</category>
    
    <comments>http://www.jmenard.com/blog/2004/06/17/javaranch_journal_article_published_on_beanutils_digester_and_type_conversion.html#comments</comments>
    <guid isPermaLink="true">http://www.jmenard.com/blog/2004/06/17/javaranch_journal_article_published_on_beanutils_digester_and_type_conversion.html</guid>
    <pubDate>Thu, 17 Jun 2004 13:15:52 GMT</pubDate>
  </item>
  
  <item>
    <title>BeanUtils, Digester, and Type Conversion</title>
    <link>http://www.jmenard.com/blog/2004/06/09/beanutils_digester_and_type_conversion.html</link>
    
      
        <description>
          &lt;p&gt;Brett Bell &lt;a href=&#034;http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;amp;f=64&amp;amp;t=000694&#034;&gt;asked on JavaRanch&lt;/a&gt; recently if &lt;a href=&#034;http://jakarta.apache.org/commons/digester/&#034;&gt;Digester&lt;/a&gt; can convert a String held in an XML attribute to a &lt;code&gt;java.util.Date&lt;/code&gt; or &lt;code&gt;int&lt;/code&gt;.  This brings up a little understood (and poorly documented, IMHO) topic relating to the Commons Digester and &lt;a href=&#034;http://jakarta.apache.org/commons/beanutils/&#034;&gt;BeanUtils&lt;/a&gt; packages - that of type conversion.&lt;/p&gt;
&lt;p&gt;The first thing to realize is that Digester does not handle the type conversions itself.  Digester makes heavy use of the BeanUtils package to work its magic, and this includes using that package for type conversions.  So in order to answer Brett&#039;s questions, we need to take a closer look at a class in BeanUtils called &lt;code&gt;&lt;a href=&#034;http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/ConvertUtils.html&#034;&gt;ConvertUtils&lt;/a&gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It is the &lt;code&gt;ConvertUtils&lt;/code&gt; class that handles type conversion for BeanUtils.  This class&#039;s &lt;code&gt;convert()&lt;/code&gt; methods allow conversions from Strings to Objects of a given class, from Objects of a given class to Strings, and from a String[] of values to an Object[] of a given class.  In order to do this, ConvertUtils must have registered with it an implementation of the &lt;em&gt;&lt;a href=&#034;http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/Converter.html&#034;&gt;Converter&lt;/a&gt;&lt;/em&gt; interface for each type of conversion it wishes to perform.&lt;/p&gt;
&lt;p&gt;The default configuration for &lt;code&gt;ConvertUtils&lt;/code&gt; will handle conversions of the following primitives and classes: java.lang.BigDecimal, java.lang.BigInteger, boolean and java.lang.Boolean, byte and java.lang.Byte, char and java.lang.Character, java.lang.Class, double and java.lang.Double, float and java.lang.Float, int and java.lang.Integer, long and java.lang.Long, short and java.lang.Short, java.lang.String, java.sql.Date, java.sql.Time, and java.sql.Timestamp.  You can add custom converters to handle anything not covered by the default configuration merely by registering your own implementation of the &lt;em&gt;Converter&lt;/em&gt; interface using the &lt;code&gt;ConvertUtils.register()&lt;/code&gt; method.&lt;/p&gt;
&lt;p&gt;Let&#039;s look at some code.  Assume we have the following XML document, &amp;quot;testdoc.xml&amp;quot;, which we wish to map to an instance of a &lt;code&gt;Thing&lt;/code&gt; class.&lt;/p&gt;
&lt;pre class=&#034;jm_code&#034;&gt;&amp;lt;thing&amp;gt;&lt;br /&gt;  &amp;lt;number&amp;gt;3&amp;lt;/number&amp;gt;&lt;br /&gt;  &amp;lt;date&amp;gt;06/07/04&amp;lt;/date&amp;gt;&lt;br /&gt;  &amp;lt;point&amp;gt;3,5&amp;lt;/point&amp;gt;&lt;br /&gt;&amp;lt;/thing&amp;gt;&lt;/pre&gt;
&lt;p&gt;Here is our &lt;code&gt;Thing&lt;/code&gt; class.&lt;/p&gt;
&lt;pre class=&#034;jm_code&#034;&gt;package commonstests;&lt;br /&gt;&lt;br /&gt;import java.awt.Point;&lt;br /&gt;import java.util.*;&lt;br /&gt;import java.text.*;&lt;br /&gt;&lt;br /&gt;public class Thing {&lt;br /&gt;    private int number;&lt;br /&gt;    private Date date;&lt;br /&gt;    private Point point;&lt;br /&gt;&lt;br /&gt;    public Thing() {&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public Date getDate() {&lt;br /&gt;        return date;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setDate(Date date) {&lt;br /&gt;        this.date = date;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public int getNumber() {&lt;br /&gt;        return number;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setNumber(int number) {&lt;br /&gt;        this.number = number;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    public Point getPoint() {&lt;br /&gt;        return point;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    public void setPoint(Point point) {&lt;br /&gt;        this.point = point;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    public String toString() {&lt;br /&gt;        String dateString = null;&lt;br /&gt;        if (date != null) {&lt;br /&gt;            dateString = DateFormat.getDateInstance().format(date);&lt;br /&gt;        }&lt;br /&gt;        StringBuffer sb = new StringBuffer();&lt;br /&gt;        sb.append(&amp;quot;[Thing number=&amp;quot;);&lt;br /&gt;        sb.append(number);&lt;br /&gt;        sb.append(&amp;quot; date=&amp;quot;);&lt;br /&gt;        sb.append(dateString);&lt;br /&gt;        sb.append(&amp;quot; point=&amp;quot;);&lt;br /&gt;        if (point != null) {&lt;br /&gt;            sb.append(point.toString());&lt;br /&gt;        } else {&lt;br /&gt;            sb.append(&amp;quot;null&amp;quot;);&lt;br /&gt;        }&lt;br /&gt;        sb.append(&amp;quot;]&amp;quot;);&lt;br /&gt;        return sb.toString();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;Looking at the XML and the &lt;code&gt;Thing&lt;/code&gt; class we can see that we want to map the XML String data to an &lt;code&gt;int&lt;/code&gt;, a &lt;code&gt;java.util.Date&lt;/code&gt;, and a &lt;code&gt;java.awt.Point&lt;/code&gt;.  Assuming an instance of &lt;code&gt;Thing&lt;/code&gt; is at the root of our digester stack, we would use the following processing rules.&lt;/p&gt;
&lt;pre class=&#034;jm_code&#034;&gt;digester.addBeanPropertySetter(&amp;quot;thing/number&amp;quot;);&lt;br /&gt;digester.addBeanPropertySetter(&amp;quot;thing/date&amp;quot;);&lt;br /&gt;digester.addBeanPropertySetter(&amp;quot;thing/point&amp;quot;);&lt;/pre&gt;
&lt;p&gt;Knowing that Digester uses BeanUtils to handle the type conversion, and knowing that an &lt;code&gt;int&lt;/code&gt; is handled by the default configuration of &lt;code&gt;ConvertUtils&lt;/code&gt;, we should have no problem processing the &lt;code&gt;&amp;lt;number&amp;gt;&lt;/code&gt; element.  Unfortunately, things will come to a screeching hault as soon as Digester tries to process the &lt;code&gt;&amp;lt;date&amp;gt;&lt;/code&gt; element.  You might think that this would be a good time to implement a custom &lt;code&gt;Converter&lt;/code&gt;.  Luckily, we don&#039;t actually have to.&lt;/p&gt;
&lt;p&gt;The BeanUtils package comes with a number of concrete &lt;code&gt;Converter&lt;/code&gt; implementations for use with locale-sensitive classes, such as &lt;code&gt;java.util.Date&lt;/code&gt;.  These locale-sensitive converters may be found in the &lt;code&gt;org.apache.commons.beanutils.locale.converters&lt;/code&gt; package.  Included in this package is &lt;code&gt;&lt;a href=&#034;http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/locale/converters/DateLocaleConverter.html&#034;&gt;DateLocaleConverter&lt;/a&gt;&lt;/code&gt;, which will handle conversion for &lt;code&gt;java.util.Date&lt;/code&gt;.  We can just go ahead and use this &lt;code&gt;Converter&lt;/code&gt; instead of implementing our own.&lt;/p&gt;
&lt;p&gt;At this point I should quickly mention that the &lt;code&gt;org.apache.commons.beanutils.locale&lt;/code&gt; package contains locale-sensitive  &lt;code&gt;LocaleBeanUtils&lt;/code&gt; and &lt;code&gt;LocaleConvertUtils&lt;/code&gt; classes which you can use in place of &lt;code&gt;BeanUtils&lt;/code&gt; and &lt;code&gt;ConvertUtils&lt;/code&gt; respectively, if you are doing a lot of locale-dependant population of your Java Beans.  Digester does not use these however so it&#039;s nothing we need to worry about right now.&lt;/p&gt;
&lt;p&gt;In order to configure a &lt;code&gt;DateLocaleConverter&lt;/code&gt; for our needs, we need to provide it with a &lt;code&gt;Locale&lt;/code&gt; and a pattern for our date format.  &lt;code&gt;DateLocaleConverter&lt;/code&gt; uses an instance of &lt;code&gt;java.text.SimpleDateFormat&lt;/code&gt; to handle the formatting, so a quick look at the API for that class will allow us to come up with a suitable pattern for our date.  Once we configure an instance of &lt;code&gt;DateLocaleConverter&lt;/code&gt; then we must simply register it with &lt;code&gt;ConvertUtils&lt;/code&gt;, also supplying the class type we wish &lt;code&gt;ConvertUtils&lt;/code&gt; to use this Converter for, which is of course &lt;code&gt;java.util.Date&lt;/code&gt; in this case.  We&#039;ll also set our instance of &lt;code&gt;DateLocaleConverter&lt;/code&gt; to be lenient in its parsing, by using the &lt;code&gt;setLenient()&lt;/code&gt; method.&lt;/p&gt;
&lt;pre class=&#034;jm_code&#034;&gt;String pattern = &amp;quot;MM/dd/yy&amp;quot;;&lt;br /&gt;Locale locale = Locale.getDefault();&lt;br /&gt;DateLocaleConverter converter = new DateLocaleConverter(locale, pattern);&lt;br /&gt;converter.setLenient(true);&lt;br /&gt;ConvertUtils.register(converter, java.util.Date.class);&lt;/pre&gt;
&lt;p&gt;Now if we use Digester to process our XML it will have no problem handling the date conversion.  Unfortunately, this time error out when it tries to process the &lt;code&gt;&amp;lt;point&amp;gt;&lt;/code&gt; element.  We need to write a custom implementation of &lt;code&gt;Converter&lt;/code&gt; to handle &lt;code&gt;java.awt.Point&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Writing an implementation of &lt;code&gt;Converter&lt;/code&gt; really isn&#039;t all that involved, and the only method we need to provide is &lt;code&gt;convert(java.lang.Class type, java.lang.Object value)&lt;/code&gt;.  This method throws a &lt;code&gt;ConversionException&lt;/code&gt; if a problem is encountered during a Conversion.  One thing to keep in mind when writing your converter is what should happen when an empty element exists in your XML, such as &lt;code&gt;&amp;lt;point/&amp;gt;&lt;/code&gt;.  Should it populate your Object with &lt;code&gt;null&lt;/code&gt; or should it use some default value?  With that in mind, it&#039;s not a bad idea to allow your converter the option of providing a default value.  Here&#039;s a converter that will handle &lt;code&gt;java.awt.Point&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&#034;jm_code&#034;&gt;package commonstests;&lt;br /&gt;&lt;br /&gt;import java.awt.Point;&lt;br /&gt;import org.apache.commons.beanutils.Converter;&lt;br /&gt;import org.apache.commons.beanutils.ConversionException;&lt;br /&gt;&lt;br /&gt;public final class PointConverter implements Converter {&lt;br /&gt;    private Object defaultValue = null;&lt;br /&gt;    private boolean useDefault = true;&lt;br /&gt;&lt;br /&gt;    public PointConverter() {&lt;br /&gt;        this.defaultValue = null;&lt;br /&gt;        this.useDefault = false;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public PointConverter(Object defaultValue) {&lt;br /&gt;        this.defaultValue = defaultValue;&lt;br /&gt;        this.useDefault = true;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public Object convert(Class type, Object value) throws Conversion Exception {&lt;br /&gt;        if (value == null) {&lt;br /&gt;            if (useDefault) {&lt;br /&gt;                return (defaultValue);&lt;br /&gt;            } else {&lt;br /&gt;                throw new ConversionException(&amp;quot;No value specified&amp;quot;);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        if (value instanceof Point) {&lt;br /&gt;            return (value);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        Point point = null;&lt;br /&gt;        if (value instanceof String) {&lt;br /&gt;            try {&lt;br /&gt;                point = parsePoint((String)value);&lt;br /&gt;            }&lt;br /&gt;            catch (Exception e) {&lt;br /&gt;                if (useDefault) {&lt;br /&gt;                    return (defaultValue);&lt;br /&gt;                } else {&lt;br /&gt;                    throw new ConversionException(e);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        } else {&lt;br /&gt;            throw new ConversionException(&amp;quot;Input value not of correct type&amp;quot;);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        return point;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private Point parsePoint(String s) throws ConversionException {&lt;br /&gt;        if (s == null) {&lt;br /&gt;            throw new ConversionException(&amp;quot;No value specified&amp;quot;);&lt;br /&gt;        }&lt;br /&gt;        if (s.length() &amp;lt; 1) {&lt;br /&gt;            return null;&lt;br /&gt;        }&lt;br /&gt;        String noSpaces = s;&lt;br /&gt;        if (s.indexOf(&#039; &#039;) &amp;gt; -1) {&lt;br /&gt;            noSpaces = s.replaceAll(&amp;quot; &amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;        }&lt;br /&gt;        String[] coords = noSpaces.split(&amp;quot;,&amp;quot;);&lt;br /&gt;        if (coords.length != 2) {&lt;br /&gt;            throw new ConversionException(&amp;quot;Value not in proper format: x,y&amp;quot;);&lt;br /&gt;        }&lt;br /&gt;        int x = 0;&lt;br /&gt;        int y = 0;&lt;br /&gt;        try {&lt;br /&gt;            x = Integer.parseInt(coords[0]);&lt;br /&gt;            y = Integer.parseInt(coords[1]);&lt;br /&gt;        } catch (NumberFormatException ex) {&lt;br /&gt;            throw new ConversionException(&amp;quot;Value not in proper format: x,y&amp;quot;);&lt;br /&gt;        }&lt;br /&gt;        Point point = new Point(x, y);&lt;br /&gt;        return point;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;There&#039;s not really all that much to it.  Of course, we also have to remember to register our &lt;code&gt;PointConverter&lt;/code&gt; with &lt;code&gt;ConvertUtils&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&#034;jm_code&#034;&gt;ConvertUtils.register(new PointConverter(), java.awt.Point.class);&lt;/pre&gt;
&lt;p&gt;Now we should have no problem with Digester performing the proper mappings.  Here&#039;s a driver you may run which demonstrates this.&lt;/p&gt;
&lt;pre class=&#034;jm_code&#034;&gt;package commonstests;&lt;br /&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.util.*;&lt;br /&gt;import org.apache.commons.beanutils.ConvertUtils;&lt;br /&gt;import org.apache.commons.beanutils.locale.converters.DateLocaleConverter;&lt;br /&gt;import org.apache.commons.digester.*;&lt;br /&gt;&lt;br /&gt;public class TestDigester {&lt;br /&gt;    private Digester digester;&lt;br /&gt;&lt;br /&gt;    public TestDigester() {&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void run() {&lt;br /&gt;        configureConverter();&lt;br /&gt;        digester = new Digester();&lt;br /&gt;        Thing thing = null;&lt;br /&gt;        File file = new File(&amp;quot;testdoc.xml&amp;quot;);&lt;br /&gt;        digester.setValidating(false);&lt;br /&gt;        digester.push(new Thing());&lt;br /&gt;        addRules();&lt;br /&gt;        try {&lt;br /&gt;            thing = (Thing)digester.parse(file);&lt;br /&gt;        } catch (Exception e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;        System.out.println(thing);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void addRules() {&lt;br /&gt;        digester.addBeanPropertySetter(&amp;quot;thing/number&amp;quot;);&lt;br /&gt;        digester.addBeanPropertySetter(&amp;quot;thing/date&amp;quot;);&lt;br /&gt;        digester.addBeanPropertySetter(&amp;quot;thing/point&amp;quot;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void configureConverter() {&lt;br /&gt;        String pattern = &amp;quot;MM/dd/yy&amp;quot;;&lt;br /&gt;        Locale locale = Locale.getDefault();&lt;br /&gt;        DateLocaleConverter converter = new DateLocaleConverter(locale, pattern);&lt;br /&gt;        converter.setLenient(true);&lt;br /&gt;        ConvertUtils.register(converter, java.util.Date.class);&lt;br /&gt;        ConvertUtils.register(new PointConverter(), java.awt.Point.class);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        TestDigester td = new TestDigester();&lt;br /&gt;        td.run();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;Happy converting!&lt;/p&gt;
        </description>
      
      
    
    
    
    <category>Articles</category>
    
    <comments>http://www.jmenard.com/blog/2004/06/09/beanutils_digester_and_type_conversion.html#comments</comments>
    <guid isPermaLink="true">http://www.jmenard.com/blog/2004/06/09/beanutils_digester_and_type_conversion.html</guid>
    <pubDate>Wed, 09 Jun 2004 16:10:33 GMT</pubDate>
  </item>
  
  <item>
    <title>Using Jakarta Commons to Create Dynamic Data Transfer Objects</title>
    <link>http://www.jmenard.com/blog/2004/04/06/using_jakarta_commons_to_create_dynamic_data_transfer_objects.html</link>
    
      
        <description>
          &lt;p&gt;In the &lt;a href=&#034;http://radio.javaranch.com/channel/jason/2004/04/05/1081179206000.html&#034;&gt;first two parts&lt;/a&gt; of the &lt;em&gt;Touring the Commons&lt;/em&gt; series we learned how to create and use DynaBeans and how to use Digester to map XML to objects. This article assumes that you have already read the previous two parts of this series and builds on that material. This time around we are going to combine what we learned and use the Digester and BeanUtils packages to create something truly useful - a framework for dynamic data transfer objects, or DTOs. I&#039;ll refer to these as DynaDTOs.&lt;/p&gt;
&lt;p&gt;A DTO is a serializable object which represents the state of a business object. More specifically, a DTO is an object containing a business object&#039;s data which may easily be transported throughout the system. By &amp;quot;easily transported&amp;quot; I mean that it is serializable and does not contain extraneous business logic. These are pretty lightweight objects. A DTO may be something as simple as a Map, but often it is a JavaBean.&lt;/p&gt;
&lt;p&gt;Creating a whole slew of JavaBeans for this purpose could certainly be tedious. Wouldn&#039;t it be nice if there were an easier way? Instead of having to hand code all those JavaBeans, it might be easier if we could simply define them using XML, similar to how one may define DynaActionForms in Struts. The combination of the BeanUtils and Digester packages will allow us to do precisely this.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#034;http://www.javaranch.com/newsletter/200404/Journal200404.jsp#a10&#034;&gt;Read the rest of this article&lt;/a&gt;&lt;/p&gt;
        </description>
      
      
    
    
    
    <category>Articles</category>
    
    <comments>http://www.jmenard.com/blog/2004/04/06/using_jakarta_commons_to_create_dynamic_data_transfer_objects.html#comments</comments>
    <guid isPermaLink="true">http://www.jmenard.com/blog/2004/04/06/using_jakarta_commons_to_create_dynamic_data_transfer_objects.html</guid>
    <pubDate>Tue, 06 Apr 2004 17:20:41 GMT</pubDate>
  </item>
  
  <item>
    <title>Articles on Jakarta Commons BeanUtils and Digester packages</title>
    <link>http://www.jmenard.com/blog/2004/04/05/articles_on_jakarta_commons_beanutils_and_digester_packages.html</link>
    
      
        <description>
          &lt;p&gt;I&#039;ve written a three part series for the &lt;a href=&#034;http://www.javaranch.com/newsletter.jsp&#034;&gt;JavaRanch Journal&lt;/a&gt; highlighting a couple of packages from the &lt;a href=&#034;http://jakarta.apache.org/commons/&#034;&gt;Jakarta Commons&lt;/a&gt; project.  &lt;a href=&#034;http://www.javaranch.com/newsletter/July2003/newsletterjuly2003.jsp#a5&#034;&gt;Part 1&lt;/a&gt; discusses the &lt;a href=&#034;http://jakarta.apache.org/commons/beanutils/&#034;&gt;BeanUtils&lt;/a&gt; package, and &lt;a href=&#034;http://www.javaranch.com/newsletter/August2003/NewsletterAugust2003.jsp#a3&#034;&gt;part 2&lt;/a&gt; discusses the &lt;a href=&#034;http://jakarta.apache.org/commons/digester/&#034;&gt;Digester&lt;/a&gt; package.  The third and final installment in the series will be published this month and shows how to use the two packages together to create dynamic data transfer objects.  I added an area to the right nav containing links to these articles, which will also contain links to articles I write in the future.&lt;/p&gt;
&lt;p&gt;If you haven&#039;t seen it already, I strongly urge you to check out the monthly &lt;a href=&#034;http://www.javaranch.com/newsletter.jsp&#034;&gt;JavaRanch Journal&lt;/a&gt;.  The Journal is chock full of useful Java related articles written by the &lt;a href=&#034;http://www.javaranch.com/&#034;&gt;JavaRanch&lt;/a&gt; staff, including published authors such as Simon Brown, Kyle Brown, Michael Yuan, Solveig Haugland, Pankaj Kumar, Kathy Sierra, and others.&lt;/p&gt;
        </description>
      
      
    
    
    
    <category>Articles</category>
    
    <comments>http://www.jmenard.com/blog/2004/04/05/articles_on_jakarta_commons_beanutils_and_digester_packages.html#comments</comments>
    <guid isPermaLink="true">http://www.jmenard.com/blog/2004/04/05/articles_on_jakarta_commons_beanutils_and_digester_packages.html</guid>
    <pubDate>Mon, 05 Apr 2004 15:33:26 GMT</pubDate>
  </item>
  
  </channel>
</rss>
