protected void processWorkUnitTemplate(
            final Configuration cfg,
            final DocWorkUnit workUnit,
            final List<Map<String, String>> indexByGroupMaps,
            final List<Map<String, String>> featureMaps)
    {
        try {
            // Merge data-model with template
            Template template = cfg.getTemplate(workUnit.getTemplateName());
            File outputPath = new File(getDestinationDir(), workUnit.getTargetFileName());
            try (final Writer out = new OutputStreamWriter(new FileOutputStream(outputPath))) {
                template.process(workUnit.getRootMap(), out);
            }
        } catch (IOException e) {
            throw new DocException("IOException during documentation creation", e);
        } catch (TemplateException e) {
            throw new DocException("TemplateException during documentation creation", e);
        }

        // Create GSON-friendly container object
        GSONWorkUnit gsonworkunit = createGSONWorkUnit(workUnit, indexByGroupMaps, featureMaps);

        gsonworkunit.populate(
                workUnit.getProperty("summary").toString(),
                workUnit.getProperty("gson-arguments"),
                workUnit.getProperty("description").toString(),
                workUnit.getProperty("name").toString(),
                workUnit.getProperty("group").toString(),
                Boolean.valueOf(workUnit.getProperty("beta").toString()),
                Boolean.valueOf(workUnit.getProperty("experimental").toString())
        );

        // Convert object to JSON and write JSON entry to file
        File outputPathForJSON = new File(getDestinationDir(), workUnit.getJSONFileName());

        try (final BufferedWriter jsonWriter = new BufferedWriter(new FileWriter(outputPathForJSON))) {
            Gson gson = new GsonBuilder()
                .serializeSpecialFloatingPointValues()
                .setPrettyPrinting()
                .create();
            String json = gson.toJson(gsonworkunit);
            jsonWriter.write(json);
        } catch (IOException e) {
            throw new DocException("Failed to create JSON entry", e);
        }
    }
protected void processWorkUnitTemplate ( final Configuration cfg , final DocWorkUnit workUnit , final List < Map < String , String > > indexByGroupMaps , final List < Map < String , String > > featureMaps ) { try { Template template = cfg . getTemplate ( workUnit . getTemplateName ( ) ) ; File outputPath = new File ( getDestinationDir ( ) , workUnit . getTargetFileName ( ) ) ; try ( final Writer out = new OutputStreamWriter ( new FileOutputStream ( outputPath ) ) ) { template . process ( workUnit . getRootMap ( ) , out ) ; } } catch ( IOException e ) { throw new DocException ( "IOException during documentation creation" , e ) ; } catch ( TemplateException e ) { throw new DocException ( "TemplateException during documentation creation" , e ) ; } GSONWorkUnit gsonworkunit = createGSONWorkUnit ( workUnit , indexByGroupMaps , featureMaps ) ; gsonworkunit . populate ( workUnit . getProperty ( "summary" ) . toString ( ) , workUnit . getProperty ( "gson-arguments" ) , workUnit . getProperty ( "description" ) . toString ( ) , workUnit . getProperty ( "name" ) . toString ( ) , workUnit . getProperty ( "group" ) . toString ( ) , Boolean . valueOf ( workUnit . getProperty ( "beta" ) . toString ( ) ) , Boolean . valueOf ( workUnit . getProperty ( "experimental" ) . toString ( ) ) ) ; File outputPathForJSON = new File ( getDestinationDir ( ) , workUnit . getJSONFileName ( ) ) ; try ( final BufferedWriter jsonWriter = new BufferedWriter ( new FileWriter ( outputPathForJSON ) ) ) { Gson gson = new GsonBuilder ( ) . serializeSpecialFloatingPointValues ( ) . setPrettyPrinting ( ) . create ( ) ; String json = gson . toJson ( gsonworkunit ) ; jsonWriter . write ( json ) ; } catch ( IOException e ) { throw new DocException ( "Failed to create JSON entry" , e ) ; } }
High-level function that processes a single DocWorkUnit unit using its handler

@param cfg
@param workUnit
@param featureMaps
@throws IOException