sorry to reply a little late, I've been quiet busy during the WE
I am having a look at your test case tonight, stay tuned!
Alles Gute,
-Simo

http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi


On Thu, Mar 6, 2014 at 5:26 PM, Jan Fröhlich <jan.froehl...@infomotion.de>wrote:

> Hi Simo,
>
> I created a small maven project with 2 test cases inside. One works but is
> ugly, the other fails but would be great.
> As I don't want to spam this mailing list I uploaded it to our webserver
> as ZIP file.
>
> You can download it from
> http://www.infomotion.de/download/objectcreate-test.zip
>
> I didn't comment it at all, but tried to give it speaking names.
> Looking forward for your feedback.
>
> Thank you for your help so far!
>
> Jan
>
> -----Ursprüngliche Nachricht-----
> Von: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] Im
> Auftrag von Simone Tripodi
> Gesendet: Donnerstag, 6. März 2014 16:43
> An: Commons Users List
> Betreff: Re: [digester] Multiple paths mapped to one object
>
> Hi Jan,
> could you submit a testcase, please?
> I will have a look at it and get back with a solution ASAP :) Alles Gute,
> -Simo
>
>
> http://people.apache.org/~simonetripodi/
> http://twitter.com/simonetripodi
>
>
> On Thu, Mar 6, 2014 at 1:09 PM, Jan Fröhlich <jan.froehl...@infomotion.de
> >wrote:
>
> > Hi Simone,
> >
> > this is something I already tried.
> > First:
> >         With a single @ObjectCreate for each table it works fine.
> > Then:
> >         Changing only to @ObjectCreate.List - without any other
> > modifications I get an error saying that there is no setter Method in
> > the table class.
> > Second:
> >         The @SetProperty attribute "pattern" is mandatory.
> >
> > Maybe this is something version dependent? I use
> >     <dependency>
> >         <groupId>org.apache.commons</groupId>
> >         <artifactId>commons-digester3</artifactId>
> >         <version>3.2</version>
> >     </dependency>
> >
> > Jan
> >
> > -----Ursprüngliche Nachricht-----
> > Von: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] Im
> > Auftrag von Simone Tripodi
> > Gesendet: Donnerstag, 6. März 2014 12:05
> > An: Commons Users List
> > Betreff: Re: [digester] Multiple paths mapped to one object
> >
> > Hi Jan,
> >
> > there's no kind of magic, just annotate the class fields as:
> >
> > @ObjectCreate.List(value = {
> >         @ObjectCreate(pattern = "*/HTABLE"),
> >         @ObjectCreate(pattern = "*/VTABLE"),
> >         @ObjectCreate(pattern = "*/XTABLE")
> > })
> > public class Table {
> >
> >     @SetProperty // you can omit the 'attributeName' since it is the
> > same as in the attribute
> >     private String name;
> >
> >     @SetProperty(attributeName = "x")
> >     private Long posX;
> >
> >     @SetProperty(attributeName = "y")
> >     private Long posY;
> >
> >     @BeanPropertySetter(pattern = "*/rows")
> >     private Long rows;
> >
> > }
> >
> > please let us know if it works! :)
> > Alles Gute!
> > -Simo
> >
> > http://people.apache.org/~simonetripodi/
> > http://twitter.com/simonetripodi
> >
> >
> > On Wed, Mar 5, 2014 at 11:55 AM, Jan Fröhlich
> > <jan.froehl...@infomotion.de>wrote:
> >
> > > Hi all,
> > >
> > > given an XML with something like
> > > <REPORT>
> > >     <XTABLE name="Table1" x="1200" y="2250">
> > >         <rows>10</rows>
> > >     </XTABLE>
> > >     <VTABLE name="Table2" x="1400" y="2250">
> > >         <rows>14</rows>
> > >     </VTABLE>
> > >     <HTABLE name="Table3" x="1600" y="2250">
> > >         <rows>17</rows>
> > >     </HTABLE>
> > > </REPORT>
> > >
> > > I would like to map all nodes (XTABLE, VTABLE and HTABLE) to one
> > > class Table and set the properties.
> > > While learning digester I created a class for each tag, but now I
> > > want to improve that.
> > >
> > > For the class itself the following should work
> > > @ObjectCreate.List(value = {
> > >         @ObjectCreate(pattern = "*/HTABLE"),
> > >         @ObjectCreate(pattern = "*/VTABLE"),
> > >         @ObjectCreate(pattern = "*/XTABLE")
> > > })
> > > public class Table {
> > >     private String name;
> > >     private Long posX;
> > >     private Long posY;
> > >     private Long rows;
> > >
> > > }
> > >
> > > But how should I annotate the properties as I have to set the
> > > pattern attribute to all @SetProperty annotations and the pattern is
> > > different for all of them.
> > >
> > > Any help appreciated.
> > >
> > > Jan
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> > For additional commands, e-mail: user-h...@commons.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>

Reply via email to