Shouldn't the inner class be mapped as a structure? Try something more like this: <?xml version="1.0" encoding="UTF-8"?> <binding direction="output"> <mapping class="x.y.z.Response" name="data"> <collection field="responseitems"> <structure type="x.y.z.ResponseItem"> <value field="error" name="error" usage="optional"/> <structure field="company" name="company" usage="optional"> <structure field="xxx" name="xxx" map-as="x.y.z.Strouble"/> ..... </structure> </structure> </collection> </mapping> <mapping class="x.y.z.Strouble" abstract="true"> <value field="d" name="d"/> <value field="s" name="s"/> </mapping> </binding>
On Mon, May 5, 2008 at 1:20 AM, Will Brown <[EMAIL PROTECTED]> wrote: > My motivation is simple. I have different output targets for my data, some > require formatted output, and others the raw numerical data. Some even > require both at the same time. > > In theory I could use your idea of specialized getters and setters with > built in formatting functionality. But I have hundreds of Stroubles, and it > is very impractical to write fancy getters for all of them individually. I > prefer to generate dumb getters automatically in Eclipse and put the logic > in the binding file. > > I'm not sure that what you want to do will work since the name of a real > getter should normally refer to the name of the field it is "gets". But I'm > not sure about this, it may work. > > My issue remains. Ideas, anyone? > > PS When I cleaned my code to present the example above I forgot to change > some of the instances of "test" to "xxx". > > > > > > > On Mon, May 5, 2008 at 2:35 AM, Steve Cohen <[EMAIL PROTECTED]> wrote: > > > I have no insight into why this is happening, but it seems to me that > > Strouble is asking for trouble. I don't know your motivation in wanting > > such a class, but since it appears from your one example that there is > > some relation between the D and the S, would it not be possible to store > > only the double value and implement a getter for the String value in > > terms of the stored double? > > > > The reason I ask you this is because I have such a class that implements > > a TelephoneNumber. It stores it as a ten-digit string stripped of all > > formatting, and then has a getFormatted() method that returns a > > presentable representation. If this is not going to work with Jibx, it > > would be good to know this before I get too far into it, and make other > > plans. > > > > > > > > > > Will Brown wrote: > > > Hello jibbixers, > > > > > > here an annoying problem I need help solving. > > > > > > I have defined a two-field Java class called Strouble, to hold a > > > double value and a String value. The idea is to keep both the raw data > > > (double) and the formatted (String) representation of one floating > > > point number in objects of this class. > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > > ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users