-
1. Re: XML2POJO Transformation
tfennelly Mar 1, 2007 6:51 AM (in response to hmrizin)This sample uses the Smooks Javabean Cartridge which is currently quite simple in terms of what it supports (but still quite powerful I think).
So, the setter methods on the beans currently only support Strings, with the data coming directly from the XML. Also, as you say, it doesn't allow you to nest bean instances - it's totally flat. This last point points to a feature that would be very useful and something I've had in mind to add for some time now. Would you like to contribute this feature ?? ;-)
Of course it depends on what you're trying to do, but the fact that the setter methods need to be Strings does not stop you having more complex types returned from whatever getter methods are added to the beans. This is typically how this might be used:
1. String injected through the setter method,
2. String analysed and transformed into more complex/usable object instances,
3. More usable object instance made available from bean via getter methods.
Thanks for the feedback! -
2. Re: XML2POJO Transformation
dmarchant Mar 1, 2007 7:43 AM (in response to hmrizin)As part of IR http://jira.jboss.com/jira/browse/JBESB-425 we are looking at providing an XStream way of deserializing beans.
Similar to the way they are serialized with the existing ObjectToXStream approach. -
3. Re: XML2POJO Transformation
hmrizin Mar 1, 2007 7:46 AM (in response to hmrizin)Thankyou tfennelly
Of course it depends on what you're trying to do, but the fact that the setter methods need to be Strings does not stop you having more complex types returned from whatever getter methods are added to the beans. This is typically how this might be used:
1. String injected through the setter method,
2. String analysed and transformed into more complex/usable object instances,
3. More usable object instance made available from bean via getter methods.
The approach that you have suggested seems to solve my problem. Will check it out. -
4. Re: XML2POJO Transformation
tfennelly Mar 1, 2007 7:54 AM (in response to hmrizin)"driedtoast" wrote:
As part of IR http://jira.jboss.com/jira/browse/JBESB-425 we are looking at providing an XStream way of deserializing beans.
Similar to the way they are serialized with the existing ObjectToXStream approach.
Sure, this is something "kinda" similar, except that there's a looser coupling between the XML format and the POJO i.e. you can populate the POJO(s) from different XML formats containing the same basic data elements.
Also, I think you could do some other useful things with this type of thing e.g. generate a different object graph depending on who the participants are in the message exchange i.e. same message generating different object graphs. -
5. Re: XML2POJO Transformation
tfennelly Mar 1, 2007 7:55 AM (in response to hmrizin)"hmrizin" wrote:
Thankyou tfennelly
Of course it depends on what you're trying to do, but the fact that the setter methods need to be Strings does not stop you having more complex types returned from whatever getter methods are added to the beans. This is typically how this might be used:
1. String injected through the setter method,
2. String analysed and transformed into more complex/usable object instances,
3. More usable object instance made available from bean via getter methods.
The approach that you have suggested seems to solve my problem. Will check it out.
Great. If you ever decide that you'd like to add support for nesting beans, be sure to come back to us ;-)