WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. This documentation is for WSO2 Complex Event Processor 4.1.0. View documentation for the latest release.

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Syntax<int|long|float|double|string|bool|object> cast(<object> toBeCasted<string> castTo)
Extension TypeFunction

Converts the first parameter according to the castTo parameter. Incompatible arguments will cause Class Cast Exceptions exceptions if further processed. This function is to be used with map extension whichwill return attribute of type object. We that returns attributes of the object type. You can use this cast function to cast the object to an accurate and concrete type.

  • toBeCasted: This specifies the attribute to be casted.
  • castTo: A string constant parameter expressing the cast to type using one of the following strings values: int, long, float, double, string, bool.
Return TypeThis will be is the same as the type of the second input parameter.
  • cast(100.3, 'double') returns 100.3d
  • cast(true, 'double') returns true
  • cast(null, 'double') returns null