commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Fröhlich <Jan.Froehl...@infomotion.de>
Subject [digester] Multiple paths mapped to one object
Date Wed, 05 Mar 2014 10:55:29 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message