First off, apologies for the long question.
I have a number of classes generated by Cayenne such as follows.
public abstract class _Form extends CayenneDataObject {
public static final String NAME_PROPERTY = "name";
public static final String FORM_ELEMENT_PROPERTY = "formElement";
public static final String FORM_ELEMENT1_PROPERTY = "formElement1";
public static final String FORM_ELEMENT2_PROPERTY = "formElement2";
public static final String ID_PK_COLUMN = "ID";
public void setName(String name) {
writeProperty("name", name);
}
public String getName() {
return (String)readProperty("name");
}
public void addToFormElement(FormElement obj) {
addToManyTarget("formElement", obj, true);
}
public void removeFromFormElement(FormElement obj) {
removeToManyTarget("formElement", obj, true);
}
@SuppressWarnings("unchecked")
public List<FormElement> getFormElement() {
return (List<FormElement>)readProperty("formElement");
}
}
I wish to turn this into an XML schema, preferably using a bind notation. The first thing to note is the above code is a "_Form.java" file, yet there is also a generated "Form.java" file that extends this class as shown below. I'm aware that "_Form.java" (above) should not be changed.
import forms.cayenne.persistent.auto._Form;
public class Form extends _Form {
}
In essence, I wish to convert this, and a few other classes, into XML like I have done in this simple class example below, using xml bind.
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "Form")
public class Form {
String name;
long ID;
@XmlElement
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlAttribute
public long getID() {
return ID;
}
public void setID(long formID) {
this.ID = formID;
}
}
What changes should I be making to the generated classes to generate the following XML?
<Form id="1">
<name>test</name>
</Form>