Sha256: 3e579204452c5e97226c17ca5bfe52a7a52506c33821d4ae018a05ccddeb3e04

Contents?: true

Size: 1.28 KB

Versions: 26

Compression:

Stored size: 1.28 KB

Contents

const NodejsStringBuilder = require("../internal/NodejsStringBuilder");
const Handlers = require("./Handlers");
const fs = require('fs');

class GeneratorHandler {

    generate(command, file_path) {

        let generator_handlers = new Handlers()
        let loadedClassFiles = []
        for (let i = 0; i < command.payload.length; i++) {
            let existing_string_builder = new NodejsStringBuilder();
            let payloadItem = command.payload[i]
            generator_handlers.GENERATOR_HANDLER[command.payload[i].commandType].generate_code(existing_string_builder, command, command.payload[i], generator_handlers)
            this.generate_class_file(existing_string_builder, command.payload[i].payload[0], file_path)
            loadedClassFiles.push(this.generate_class_file(existing_string_builder, payloadItem.payload[0],file_path))
        }
        return loadedClassFiles
    }


    generate_class_file(existing_string_builder, class_file_name, file_path) {
        fs.writeFile(file_path + "\\" + class_file_name.substring(class_file_name.lastIndexOf(".") + 1) + '.js', existing_string_builder.getString(), function (err) {
            if (err) throw err;
        });
        return existing_string_builder.getString();
    }
}

module.exports = GeneratorHandler

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.1.5 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.1.4 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.1.3 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.1.2 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.1.1 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/generator/handler/GeneratorHandler.js
javonet-ruby-sdk-2.1.0 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/generator/handler/GeneratorHandler.js