Sha256: d4f93386a164bd4c55cf8b09a4411e0e99d4e6646c58fa91647ef14cf0884363

Contents?: true

Size: 906 Bytes

Versions: 8

Compression:

Stored size: 906 Bytes

Contents

const AbstractHandler = require("./AbstractHandler")

class SetGlobalStaticFieldHandler extends AbstractHandler {
    requiredParametersCount = 2

    constructor() {
        super()
    }

    process(command) {
        try {
            if (command.payload.length < this.requiredParametersCount) {
                throw new Error("Set gloabal static field parameters mismatch")
            }
            const {payload} = command
            const splitted = payload[0].split(".")
            const value = payload[1]
            let fieldToSet

            for (let i = 0; i < splitted.length; i++) {
                fieldToSet = !fieldToSet ? global[splitted[i]] : fieldToSet[splitted[i]]
            }
            fieldToSet = value
        } catch (error) {
            throw this.process_stack_trace(error, this.constructor.name)
        }
    }
}

module.exports = new SetGlobalStaticFieldHandler()

Version data entries

8 entries across 4 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.1.14 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/SetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.14 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/SetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.13 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/SetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.13 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/SetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.12 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/SetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.12 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/SetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.11 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/SetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.11 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/SetGlobalStaticFieldHandler.js