private void write(TargetType theTarget, ValueSetTm theValueSetTm, File theOutputDirectory, String thePackageBase) throws IOException {
		if (!theOutputDirectory.exists()) {
			theOutputDirectory.mkdirs();
		}
		if (!theOutputDirectory.isDirectory()) {
			throw new IOException(theOutputDirectory + " is not a directory");
		}

		String valueSetName = theValueSetTm.getClassName();
		String prefix = myFilenamePrefix;
		String suffix = myFilenameSuffix;
		if (theTarget == TargetType.SOURCE) {
			if (!suffix.endsWith(".java")) {
				suffix += ".java";
			}
		}
		String fileName = prefix + valueSetName + suffix;
		File f = new File(theOutputDirectory, fileName);
		OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(f, false), "UTF-8");

		ourLog.debug("Writing file: {}", f.getAbsolutePath());

		VelocityContext ctx = new VelocityContext();
		InputStream templateIs = null;
		ctx.put("valueSet", theValueSetTm);
		ctx.put("packageBase", thePackageBase);
		ctx.put("esc", new EscapeTool());

		VelocityEngine v = VelocityHelper.configureVelocityEngine(myTemplateFile, myVelocityPath, myVelocityProperties);
		if (myTemplateFile != null) {
			templateIs = new FileInputStream(myTemplateFile);
		} else {
			String templateName = myTemplate;
			if (null == templateName) {
				templateName = "/vm/valueset.vm";
			}
			templateIs = this.getClass().getResourceAsStream(templateName);
		}

		InputStreamReader templateReader = new InputStreamReader(templateIs, "UTF-8");
		v.evaluate(ctx, w, "", templateReader);

		w.close();
	}
private void write ( TargetType theTarget , ValueSetTm theValueSetTm , File theOutputDirectory , String thePackageBase ) throws IOException { if ( ! theOutputDirectory . exists ( ) ) { theOutputDirectory . mkdirs ( ) ; } if ( ! theOutputDirectory . isDirectory ( ) ) { throw new IOException ( theOutputDirectory + " is not a directory" ) ; } String valueSetName = theValueSetTm . getClassName ( ) ; String prefix = myFilenamePrefix ; String suffix = myFilenameSuffix ; if ( theTarget == TargetType . SOURCE ) { if ( ! suffix . endsWith ( ".java" ) ) { suffix += ".java" ; } } String fileName = prefix + valueSetName + suffix ; File f = new File ( theOutputDirectory , fileName ) ; OutputStreamWriter w = new OutputStreamWriter ( new FileOutputStream ( f , false ) , "UTF-8" ) ; ourLog . debug ( "Writing file: {}" , f . getAbsolutePath ( ) ) ; VelocityContext ctx = new VelocityContext ( ) ; InputStream templateIs = null ; ctx . put ( "valueSet" , theValueSetTm ) ; ctx . put ( "packageBase" , thePackageBase ) ; ctx . put ( "esc" , new EscapeTool ( ) ) ; VelocityEngine v = VelocityHelper . configureVelocityEngine ( myTemplateFile , myVelocityPath , myVelocityProperties ) ; if ( myTemplateFile != null ) { templateIs = new FileInputStream ( myTemplateFile ) ; } else { String templateName = myTemplate ; if ( null == templateName ) { templateName = "/vm/valueset.vm" ; } templateIs = this . getClass ( ) . getResourceAsStream ( templateName ) ; } InputStreamReader templateReader = new InputStreamReader ( templateIs , "UTF-8" ) ; v . evaluate ( ctx , w , "" , templateReader ) ; w . close ( ) ; }
}