private void generateClassesFromSchema(JCodeModel codeModel, File src) { try { Object writer = JAXBUtils.createFileCodeWriter(src, encoding == null ? StandardCharsets.UTF_8.name() : encoding); codeModel.build(writer); generatedTypeClasses = JAXBUtils.getGeneratedClassNames(codeModel); } catch (Exception e) { throw new IllegalStateException("Unable to write generated Java files for schemas: " + e.getMessage(), e); } }
public static Object createFileCodeWriter(File f, String encoding) throws JAXBException { try { Class<?> cls; try { cls = Class.forName("com.sun.codemodel.writer.FileCodeWriter"); } catch (ClassNotFoundException e) { cls = Class.forName("com.sun.codemodel.internal.writer.FileCodeWriter", true, getXJCClassLoader()); } if (encoding != null) { try { return cls.getConstructor(File.class, String.class) .newInstance(f, encoding); } catch (Exception ex) { // try a single argument constructor } } return cls.getConstructor(File.class).newInstance(f); } catch (Exception ex) { throw new JAXBException(ex); } }
public static Object createFileCodeWriter(File f, String encoding) throws JAXBException { try { Class<?> cls; try { cls = Class.forName("com.sun.codemodel.writer.FileCodeWriter"); } catch (ClassNotFoundException e) { cls = Class.forName("com.sun.codemodel.internal.writer.FileCodeWriter", true, getXJCClassLoader()); } if (encoding != null) { try { return cls.getConstructor(File.class, String.class) .newInstance(f, encoding); } catch (Exception ex) { // try a single argument constructor } } return cls.getConstructor(File.class).newInstance(f); } catch (Exception ex) { throw new JAXBException(ex); } }
public static Object createFileCodeWriter(File f, String encoding) throws JAXBException { try { Class<?> cls; try { cls = Class.forName("com.sun.codemodel.writer.FileCodeWriter"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block cls = Class.forName("com.sun.codemodel.internal.writer.FileCodeWriter", true, getXJCClassLoader()); } if (encoding != null) { try { return cls.getConstructor(File.class, String.class) .newInstance(f, encoding); } catch (Exception ex) { // try a single argument constructor } } return cls.getConstructor(File.class).newInstance(f); } catch (Exception ex) { throw new JAXBException(ex); } }
public static Object createFileCodeWriter(File f, String encoding) throws JAXBException { try { Class<?> cls; try { cls = Class.forName("com.sun.codemodel.writer.FileCodeWriter"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block cls = Class.forName("com.sun.codemodel.internal.writer.FileCodeWriter", true, getXJCClassLoader()); } if (encoding != null) { try { return cls.getConstructor(File.class, String.class) .newInstance(f, encoding); } catch (Exception ex) { // try a single argument constructor } } return cls.getConstructor(File.class).newInstance(f); } catch (Exception ex) { throw new JAXBException(ex); } }
Object writer = JAXBUtils.createFileCodeWriter(src); codeModel.build(writer); } catch (Exception e) {
Object writer = JAXBUtils.createFileCodeWriter(src); codeModel.build(writer); } catch (Exception e) {
Object writer = JAXBUtils.createFileCodeWriter(src); codeModel.build(writer); } catch (Exception e) {
Object writer = JAXBUtils.createFileCodeWriter(src); codeModel.build(writer); } catch (Exception e) {