commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian <nospam...@gmx.net>
Subject Re: Betwixt: Setting up BeanWriter to render a bean property as attribute rather than element
Date Sat, 07 Feb 2004 14:37:20 GMT
robert burrell donkin wrote:
> On 4 Feb 2004, at 15:29, Sebastian wrote:
> 
>> Hi Robert,
> 
> 
> hi sebastian
> 
>> thanks a lot for adding this new Mapper. A dumb question: how can I 
>> access the refactoring branch? I'm using eclipse to access the apache 
>> CVS but can't  see that branch anywhere.
> 
> 
> i'd say that the easiest way would be to update (a checked out version) 
> to the branch (cvs -q up -r REFACTORING-BRANCH_2004-01-13 -d -P in the 
> betwixt folder) outside eclipse (the ASF does not allow history commands 
> and i have a feel this is how eclipse finds out about branches. (you'll 
> need to get hold of a command line client to do this if you don't have 
> one already.)
> 
> i broke with tradition for the betwixt refactoring and used eclipse (i 
> almost always using a simple test editor for the projects i work on) and 
> so i know that betwixt will build fine without it but i'd strongly 
> recommend downloading maven (http://maven.apache.org) so that you can 
> build standard distributions and the documentation.
> 
> - robert
Hi Robert,
I managed to download the refactoring branch and build a distribution 
using maven. The I created a custom simplytypemapper and launched a 
junit test on my project. Then I discovered that nearly nothing works 
anymore. I removed my simpletypemapper and tried using the .betwixt 
files again. the junit test still failed. then I recognized, that 
collections are not unserialized as they used to do before, so when I 
have an xml like this
<categories>
    <category>...</cateogry>
    <category>...</cateogry>
    <category>...</cateogry>
</categories>
I expected that calling beanReader.parse(new StringReader(myXml)) 
returns a Categories object as it did before (using betwixt alpha 1), 
but for any reason it now returns a Category object.
Did anything substantial changed in how betwixt handles collections?

This is how I configured the beanreader:
   BeanReader beanReader = new BeanReader();
   XMLIntrospector xi = beanReader.getXMLIntrospector();
   IntrospectionConfiguration ic = xi.getConfiguration();
   ic.setAttributesForPrimitives(false);
   ic.setElementNameMapper(capitalizeNameMapper);
   ic.setAttributeNameMapper(capitalizeNameMapper);
   ic.setWrapCollectionsInElement(false);
   beanReader.getBindingConfiguration().setMapIDs(false);

   beanReader.registerBeanClass(Category.class);
   beanReader.registerBeanClass(Categories.class);

Thanks in advance,
Sebastian


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message