* @param classDescriptor
* @param objectFactory
* @return
*/
private JavaType createJAXBType(ClassDescriptor classDescriptor, ObjectFactory objectFactory) {
JavaType javaType = new JavaType();
javaType.setName(classDescriptor.getAlias());
javaType.setJavaAttributes(new JavaAttributes());
boolean isDynamic = DynamicEntity.class.isAssignableFrom(classDescriptor.getJavaClass());
for (DatabaseMapping ormMapping : classDescriptor.getMappings()) {
JAXBElement<XmlElement> element = createJAXBProperty(ormMapping, objectFactory, javaType, isDynamic);
if (element != null){
javaType.getJavaAttributes().getJavaAttribute().add(element);
}
}
// Make them all root elements for now
javaType.setXmlRootElement(new org.eclipse.persistence.jaxb.xmlmodel.XmlRootElement());
// Set an adapter that is a subclass of ReferenceAdapter that can adapt the class to create a link for
// the persistence_href field that has been weaved in.
String name = RestAdapterClassWriter.constructClassNameForReferenceAdapter(classDescriptor.getJavaClassName());
XmlJavaTypeAdapter adapter = new XmlJavaTypeAdapter();
adapter.setValue(name);
adapter.setValueType(classDescriptor.getJavaClassName());
adapter.setType(classDescriptor.getJavaClassName());
javaType.setXmlJavaTypeAdapter(adapter);
return javaType;
}