JADE Environment Development Ideas

What's new in the upcoming JADE release?

IMPROVED DEVELOPER EFFICIENCY. ENHANCED SECURITY. SMOOTHER INTEGRATION

The JADE 2022 release meets tomorrow’s business demands.


Start your update to JADE's latest release

sendMsgWithParams Difficulty Casting To Destination Type

I'm encountering quirky behaviour using 'sendMsgWithParams' with mixed types between the source variable and destination argument. An example to re-create the issue:

  • Sending a variable as Binary type

  • Receiving a argument as String

destinationMethod(inputArgument : String);

begin

write inputArgument;

end;

sendingMethod();

begin

sendMsgWithParams("destinationMethod", "text".Binary);

end;

Run the above the 'write' statement is: 74 65 78 74 >text <

To get the expected result, I need to change the destinationMethod line to: write inputArgument.String;

The above can be re-created with other combinations of types like numbers. To work around this I have cast the arguments again in the receiving methods, which kinda looks weird seeing arguments cast as String with the suffix ".String". I'm having to make this change to more and more methods, so now more code is looking weirder.

The other option is to create a sendMsgWithParams overload that does a type-check and re-casts all the arguments before invoking the method... this solution seems a bit overkill.

Any chance I have missed something and there is a better way to work around this? The long story is I'm de-serializing json payloads and pushing the data to methods. I know the expected type of the argument when I figure out the destination method (which depends on the payload), just trying to find a cleaner way to code this.

  • Guest
  • Jul 28 2025
  • Needs review
  • Attach files
  • Guest commented
    04 Sep 22:11

    May I request the 'Parameter' class have a new method: getType()


    Thanks

  • Guest commented
    07 Aug 01:22

    I appreciate that I need to ensure the parameter type matches the destination method.

    I can retrieve the 'ParameterColl' from the method with the along with the 'Parameter' objects. Is there a way I can get the type for each parameter? If so I can re-cast my variable and send it's new type to 'sendMsgWithParams'.

    I am hoping there is a way more strongly-typed than reading the first line of the source code and deciphering the parameters that way.

  • Guest commented
    06 Aug 21:59

    This may be more appropriate for the Jade Forums, as it's not a suggestion for an improvement in Jade. It is the developers responsibility to ensure you are passing the correct types into sendMsgWithParams to avoid unexpected behaviour, as per the following comment in the documentation:

    "If the number or type of the actual parameters passed to a method or condition by a parameter list does not correspond exactly to the formal parameter list declaration, an exception or an unpredictable result can occur, as the compiler is unable to perform any type checking on the values that are passed to a parameter list."