Wednesday 16 May 2012

adding set methods in JAXB for collections

Normally the JAXB generated classes will not contain set methods for collections. (The idea here is to access collections only using get as the basis assumption is the change only happens to the contents of the collection).

if you use the maven maven-jaxb2-plugin, then you can use collection-setter-injector plugin along with jaxb2 plugin to create set methods. Below is a sample configuration,













<!-- This helps generate setter methods-->








<!-- plugin to generate setter for collection-->