Sha256: 5bc1ff6c5f09fd4363fe1531b4d541a3b47e0a87d2ef67cd42c5ead994737b58

Contents?: true

Size: 1011 Bytes

Versions: 11

Compression:

Stored size: 1011 Bytes

Contents

const AbstractHandler = require("./AbstractHandler");

class GetStaticFieldHandler extends AbstractHandler {
  requiredParametersCount = 2;

  constructor() {
    super();
  }

  process(command) {
    try {
      if (command.payload.length < this.requiredParametersCount) {
        throw new Error("Array Static Field parameters mismatch");
      }
      const { payload } = command;
      let type = payload[0];
      let field = payload[1];

      let staticField = type[field];
      if (typeof staticField === "undefined") {
        let fields = Object.keys(type);
        let message = `Field ${field} not found in class. Available fields:\n`;
        fields.forEach((fieldIter) => {
          message += `${fieldIter}\n`;
        });
        throw new Error(message);
      } else {
        return staticField;
      }
    } catch (error) {
      throw this.process_stack_trace(error, this.constructor.name);
    }
  }
}

module.exports = new GetStaticFieldHandler();

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.4.10 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js
javonet-ruby-sdk-2.4.9 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js
javonet-ruby-sdk-2.4.8 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js
javonet-ruby-sdk-2.4.7 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js
javonet-ruby-sdk-2.4.6 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js
javonet-ruby-sdk-2.4.5 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js
javonet-ruby-sdk-2.4.4 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js
javonet-ruby-sdk-2.4.3 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js
javonet-ruby-sdk-2.4.2 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js
javonet-ruby-sdk-2.3.0 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js
javonet-ruby-sdk-2.2.0 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetStaticFieldHandler.js