protected void writeJavaFile(File packageDirectory, JCodeModel codeModel) { try { FileCodeWriter fcw = new FileCodeWriter(packageDirectory); codeModel.build(fcw); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
/** * Creates a configured CodeWriter that produces files into the specified directory. * * @return * @throws java.io.IOException */ public CodeWriter createCodeWriter() throws IOException { return createCodeWriter(new FileCodeWriter(targetDir, readOnly, encoding)); }
/** * Creates a configured CodeWriter that produces files into the specified directory. * * @return * @throws java.io.IOException */ public CodeWriter createCodeWriter() throws IOException { return createCodeWriter(new FileCodeWriter(targetDir, readOnly, encoding)); }
/** * Creates a configured CodeWriter that produces files into the specified directory. * * @return * @throws java.io.IOException */ public CodeWriter createCodeWriter() throws IOException { return createCodeWriter(new FileCodeWriter(targetDir, readOnly, encoding)); }
/** * Creates a configured CodeWriter that produces files into the specified directory. */ public CodeWriter createCodeWriter() throws IOException { return createCodeWriter(new FileCodeWriter( targetDir, readOnly )); }
/** * Creates a configured CodeWriter that produces files into the specified directory. */ public CodeWriter createCodeWriter() throws IOException { return createCodeWriter(new FileCodeWriter( targetDir, readOnly )); }
public void generate(final File targetFolder, final String comment) throws IOException { if (!targetFolder.exists()) { targetFolder.mkdirs(); } final CodeWriter sourceCodeWriter = new SourceCodeWriter(targetFolder, comment); final CodeWriter fileCodeWriter = new FileCodeWriter(targetFolder); this.codeModel.build(sourceCodeWriter, fileCodeWriter); }
/** * Generates Java source code. * A convenience method that calls {@link #build(CodeWriter,CodeWriter)}. * * @param srcDir * Java source files are generated into this directory. * @param resourceDir * Other resource files are generated into this directory. * @param status * if non-null, progress indication will be sent to this stream. */ public void build( File srcDir, File resourceDir, PrintStream status ) throws IOException { CodeWriter src = new FileCodeWriter(srcDir); CodeWriter res = new FileCodeWriter(resourceDir); if(status!=null) { src = new ProgressCodeWriter(src, status ); res = new ProgressCodeWriter(res, status ); } build(src,res); }
/** * Generates Java source code. * A convenience method that calls {@link #build(CodeWriter,CodeWriter)}. * * @param srcDir * Java source files are generated into this directory. * @param resourceDir * Other resource files are generated into this directory. * @param status * if non-null, progress indication will be sent to this stream. */ public void build( File srcDir, File resourceDir, PrintStream status ) throws IOException { CodeWriter src = new FileCodeWriter(srcDir); CodeWriter res = new FileCodeWriter(resourceDir); if(status!=null) { src = new ProgressCodeWriter(src, status ); res = new ProgressCodeWriter(res, status ); } build(src,res); }
/** * Generates Java source code. * A convenience method that calls {@link #build(CodeWriter,CodeWriter)}. * * @param srcDir * Java source files are generated into this directory. * @param resourceDir * Other resource files are generated into this directory. * @param status * if non-null, progress indication will be sent to this stream. */ public void build( File srcDir, File resourceDir, PrintStream status ) throws IOException { CodeWriter src = new FileCodeWriter(srcDir); CodeWriter res = new FileCodeWriter(resourceDir); if(status!=null) { src = new ProgressCodeWriter(src, status ); res = new ProgressCodeWriter(res, status ); } build(src,res); }
/** * Generates Java source code. * A convenience method that calls {@link #build(CodeWriter,CodeWriter)}. * * @param srcDir * Java source files are generated into this directory. * @param resourceDir * Other resource files are generated into this directory. * @param status * if non-null, progress indication will be sent to this stream. */ public void build( File srcDir, File resourceDir, PrintStream status ) throws IOException { CodeWriter src = new FileCodeWriter(srcDir); CodeWriter res = new FileCodeWriter(resourceDir); if(status!=null) { src = new ProgressCodeWriter(src, status ); res = new ProgressCodeWriter(res, status ); } build(src,res); }
/** * Generates Java source code. * A convenience method that calls {@link #build(CodeWriter,CodeWriter)}. * * @param srcDir * Java source files are generated into this directory. * @param resourceDir * Other resource files are generated into this directory. * @param status * if non-null, progress indication will be sent to this stream. */ public void build( File srcDir, File resourceDir, PrintStream status ) throws IOException { CodeWriter src = new FileCodeWriter(srcDir); CodeWriter res = new FileCodeWriter(resourceDir); if(status!=null) { src = new ProgressCodeWriter(src, status ); res = new ProgressCodeWriter(res, status ); } build(src,res); }
CodeWriter w = new FilterCodeWriter(encoding != null ? new FileCodeWriter(outputDirectory, encoding) : new FileCodeWriter(outputDirectory)) {
t.generateTo(new FileCodeWriter(dir));
private void generateTypes() throws ToolException { if (rawJaxbModelGenCode == null) { return; } try { if (rawJaxbModelGenCode instanceof S2JJAXBModel) { S2JJAXBModel schem2JavaJaxbModel = (S2JJAXBModel)rawJaxbModelGenCode; JCodeModel jcodeModel = schem2JavaJaxbModel.generateCode(null, null); String dir = (String)env.get(ToolConstants.CFG_OUTPUTDIR); FileCodeWriter fileCodeWriter = new FileCodeWriter(new File(dir)); jcodeModel.build(fileCodeWriter); } else { return; } } catch (IOException e) { Message msg = new Message("FAIL_TO_GENERATE_TYPES", LOG); throw new ToolException(msg); } }
JCodeModel codeModel = jaxbModel.generateCode(null, null); try { codeModel.build(new FileCodeWriter(outputDir)); createTraces(xsdTraces, schemaFile); return codeModel;
_log.info("Generating " + targetFiles.size() + " files"); _log.debug("Files: " + targetFiles); requestBuilderCodeModel.build(new FileCodeWriter(targetDirectory, true)); dataTemplateCodeModel.build(new FileCodeWriter(targetDirectory, true));
FileCodeWriter writer = new FileCodeWriter(outputDir); codeModel.build(writer);
FileCodeWriter writer = new FileCodeWriter(outputDir, cgconfig.getOutputEncoding()); codeModel.build(writer);