Affects Version/s: 1.3.1
Fix Version/s: 1.4
The classes in the com.thoughtworks.xstream.converters.javabean package have a lot of private or package private fields and methods. This makes it very difficult to customize the behavior of these classes without duplicating a lot of the core code
Any chance of this making it in to 1.4? Being able to override methods in the BeanProvider is crucial for me (I need to order the fields in a certain way).
finally ... I am looking into this before finishing 1.4. However, I am not that confident with opening the implementation at all edges. I rather try to get implementation and entry points of ReflectionProvider and BeanProvider more in sync. Therefore I will first factor out the new interface JavaBeanProvider from BeanProvider to match the architecture of the reflection package. This will provide you with most flexibility in first place. WDYT?
The current implementation uses now a similar design as the reflection-based stuff. I reintroduced the PropertyDictionary that can be setup with an own PropertySorter. I think I provide now quite similar extension points compared to your original patch. Implementation is in trunk.
The improvements you made to the BeanProvider are great, they provide exactly what I need.
Unfortunately, the Visitor pattern is the same as in 1.3.x
I need to be able to control whether the class attribute is written out on some elements and to do so, I need to be able to override/extend the Visitor that is passed to the BeanProvider
isn't this possible by simply overloading JavaBeanConverter.marshal(...)? I realize, that you have to keep the mapper yourself for now, but it has to be provided with the converter's constructor, so it is a simple annoyance. In trunk it is now already declared as "protected final" (analogue to AbstractReflectionConverter).
Resolving the issue, assuming that the protected field is enough. New snapshot is available in the repo.
The attached patch makes some minor adjusts to the access modifiers and does some light refactoring to make things more extensible