XMLContext xmlContext = null;
JaxbClassLoader loader = new JaxbClassLoader(classLoader);
Generator generator = new Generator(new JavaModelInputImpl(classesToBeBound, new JavaModelImpl(loader)));
try {
Project proj = generator.generateProject();
ConversionManager conversionManager = null;
if (classLoader != null) {
conversionManager = new ConversionManager();
conversionManager.setLoader(loader);
} else {
conversionManager = ConversionManager.getDefaultManager();
}
// need to make sure that the java class is set properly on each
// descriptor when using java classname - req'd for JOT api implementation
for (Iterator<ClassDescriptor> descriptorIt = proj.getOrderedDescriptors().iterator(); descriptorIt.hasNext();) {
ClassDescriptor descriptor = descriptorIt.next();
if (descriptor.getJavaClass() == null) {
descriptor.setJavaClass(conversionManager.convertClassNameToClass(descriptor.getJavaClassName()));
}
}
xmlContext = new XMLContext(proj, loader);
jaxbContext = new org.eclipse.persistence.jaxb.JAXBContext(xmlContext, generator);
} catch (Exception ex) {