I used Castor in the last couple of days to try and get a little serialization between my Java program and XML in a readable way. Although it has several drawbacks, the automatic generation of xml Castor through reflection is actually very functional. Unfortunately, one thing that does not seem to be mentioned quite well in the examples is generics. The reflection API seems to do the job fine, but since it inadvertently captures a lot of redundant data just because the methods start with get___(), I wanted to write my own mapping file to prevent this.
Firstly, it seems quite fair that the " field" should be defined in the attributes of the " " element type. However, it does not indicate what should be done if this type is abstract or just an interface. What should I put as a type?
Secondly, the majority of objects of type "collection" specified in Castor ( List, Vector, Collection, Setetc.), require only one common type, therefore specify " type" such as that inside and " collection="true"" enough. However, it does not indicate what I should do in the case of a type collection Mapwhere 2 types are needed. How to specify the type and type of key?
Any help at all would be greatly appreciated!
source
share