I have various sets of Java objects, some of them pojos generated from JAXB tools, some of them domain classes etc.. In a large application, I need to get data from one set of objects and put into another set of objects which have different capabilities to use the data.
There are various methods of doing this: object mapping frameworks being an obvious choice. However, most of these frameworks with a solid code base and community, use reflection.(dozer for example)
I've been using a combination of adapters which adopt pojos and more complex java classes to visitor pattern, so that a visitor walking on the adaptor walks over one set of objects, and in the process creates another set of objects (the objects usually have parent/child/tree type of references) Especially when pass by reference is used rather than creating new Strings etc, this should be the fastest method available.
Can you think of any other method? Some sort of serialization to a byte array in memory, then deserialization maybe? Could it beat visitor based copies in terms of performance? Am I being unfair to reflection based approaches like Dozer? This is a key operation in the application, so any improvements are likely to improve overall performance significantly.