Jaxb: How do I generate ObjectFactory class?

前端 未结 3 1794
无人及你
无人及你 2021-01-05 09:42

I\'m using Java 6, JaxB 2 and SpringSource Tool Suite (same as Eclipse). I had a couple of Java classes I wrote, from which I used JaxB to generate an XML schema. However,

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-05 10:05

    You don't 'need' a factory for the JaxB marshaller to function. If you pass it an object with a list or a map variable, it will in fact marshall it correctly. This is of course true only if you've correctly initilized the JaxB marshaller towards the object's class that you want to marshall.

    You can create a factory, and that factory can create some specialized return (say you don't want it to return your public temp variables)

提交回复
热议问题