Class ExpressionResolver

Assembly: redb.Route.dll

Partial class ExpressionResolver — AST parsing, compilation, and integration.

public static class ExpressionResolver

Inheritance

Object→ExpressionResolver

Methods

Ast_Abs(object?)

Returns the absolute value.

public static object? Ast_Abs(object? value)

Ast_ApplyAddition(object?, object?)

Applies addition via AST delegation.

public static object? Ast_ApplyAddition(object? left, object? right)

Ast_ApplyDivision(object?, object?)

Applies division via AST delegation.

public static object? Ast_ApplyDivision(object? left, object? right)

Ast_ApplyModulo(object?, object?)

Modulo over the same numeric coercion as division: both operands convert

public static object? Ast_ApplyModulo(object? left, object? right)

Ast_ApplyMultiplication(object?, object?)

Applies multiplication via AST delegation.

public static object? Ast_ApplyMultiplication(object? left, object? right)

Ast_ApplySubtraction(object?, object?)

Applies subtraction via AST delegation.

public static object? Ast_ApplySubtraction(object? left, object? right)

Ast_ApplyUnaryMinus(object?)

Applies unary minus via AST delegation.

public static object? Ast_ApplyUnaryMinus(object? value)

Ast_ApplyUnaryNot(object?)

Applies unary NOT via AST delegation.

public static object? Ast_ApplyUnaryNot(object? value)

Ast_ApplyUnaryPlus(object?)

Applies unary plus via AST delegation.

public static object? Ast_ApplyUnaryPlus(object? value)

Ast_AreEqual(object?, object?)

Checks equality of two values via AST delegation.

public static bool Ast_AreEqual(object? left, object? right)

Ast_AreNotEqual(object?, object?)

Returns true if the values are NOT equal.

public static bool Ast_AreNotEqual(object? left, object? right)

Ast_AttachmentContent(object?, IExchange)

attachmentContent(name): the content of the first attachment with that name as bytes, or null.

public static object? Ast_AttachmentContent(object? name, IExchange exchange)

Ast_AttachmentContentAsText(object?, IExchange)

attachmentContentAsText(name): the content of the first attachment with that name as text, decoded with

public static object? Ast_AttachmentContentAsText(object? name, IExchange exchange)

Ast_AttachmentContentType(object?, IExchange)

attachmentContentType(name): the content type of the first attachment with that name, or null.

public static object? Ast_AttachmentContentType(object? name, IExchange exchange)

Ast_AttachmentHeader(object?, object?, IExchange)

attachmentHeader(name, header): a MIME header of the first attachment with that name (case-insensitive),

public static object? Ast_AttachmentHeader(object? name, object? header, IExchange exchange)

Ast_Avg(object?)

Averages all numeric values in a collection.

public static object? Ast_Avg(object? value)

Ast_CompareNumeric(object?, object?)

Compares two numeric values via AST delegation.

public static int Ast_CompareNumeric(object? left, object? right)

Ast_Concat(params object?[])

Concatenates the string representations of all arguments.

public static object? Ast_Concat(params object?[] args)

Ast_Contains(object?, object?)

Checks if a string contains a substring (case-insensitive).

public static object? Ast_Contains(object? value, object? search)

Ast_ConvertToBool(object?)

Converts a value to boolean. Returns false for null, empty strings, zero, and "false";

public static bool Ast_ConvertToBool(object? value)

Ast_Count(object?)

Counts elements in a collection.

public static object? Ast_Count(object? value)

Ast_DateAdd(object?, object?, object?)

Adds a time interval to a date value.

public static object? Ast_DateAdd(object? value, object? amount, object? unit)

Ast_DateDiff(object?, object?, object?)

Difference between two dates, first minus second, in the requested unit.

public static object? Ast_DateDiff(object? left, object? right, object? unit)

Ast_DateFormat(object?, object?)

Formats a date value using the specified format string.

public static object? Ast_DateFormat(object? value, object? format)

Ast_EndsWith(object?, object?)

Checks if a string ends with a suffix (case-insensitive).

public static object? Ast_EndsWith(object? value, object? suffix)

Ast_Format(object?, object?, object?)

Formats a value with a .NET format string and an optional culture name:

public static object? Ast_Format(object? value, object? format, object? culture)

Ast_GreaterThan(object?, object?)

Returns true if left is greater than right.

public static bool Ast_GreaterThan(object? left, object? right)

Ast_GreaterThanOrEqual(object?, object?)

Returns true if left is greater than or equal to right.

public static bool Ast_GreaterThanOrEqual(object? left, object? right)

Ast_In(object?, object?, bool, string)

value in list / value not in list, shared by the interpreted and the compiled

public static bool Ast_In(object? value, object? list, bool negated, string display)

Ast_IndexAccess(object?, object?)

Accesses an element by index in a collection, array, or dictionary-like object.

public static object? Ast_IndexAccess(object? obj, object? index)

Ast_JPath(object?, IExchange)

Evaluates a jpath() function via AST delegation.

public static object? Ast_JPath(object? path, IExchange exchange)

Ast_JPathFrom(object?, object?, IExchange)

Evaluates the two-argument jpath(path, source), which reads the source instead of the

public static object? Ast_JPathFrom(object? path, object? source, IExchange exchange)

Ast_Length(object?)

Returns the length of a string or collection.

public static object? Ast_Length(object? value)

Ast_LessThan(object?, object?)

Returns true if left is less than right.

public static bool Ast_LessThan(object? left, object? right)

Ast_LessThanOrEqual(object?, object?)

Returns true if left is less than or equal to right.

public static bool Ast_LessThanOrEqual(object? left, object? right)

Ast_Logical(object?, IExchange)

Evaluates a logical() function — converts a value to bool.

public static object? Ast_Logical(object? value, IExchange exchange)

Ast_LogicalAnd(object?, object?)

Evaluates logical AND between two values.

public static bool Ast_LogicalAnd(object? left, object? right)

Ast_LogicalOr(object?, object?)

Evaluates logical OR between two values.

public static bool Ast_LogicalOr(object? left, object? right)

Ast_LogicalXor(object?, object?)

Evaluates logical XOR between two values.

public static bool Ast_LogicalXor(object? left, object? right)

Ast_Lower(object?)

Converts a string to lower case.

public static object? Ast_Lower(object? value)

Ast_Max(object?, object?)

Returns the maximum of two values, or of every numeric value in a collection.

public static object? Ast_Max(object? a, object? b)

Ast_MessageHistory(object?, IExchange)

Evaluates messageHistory(kind) — the trail the exchange left through the route, as a value.

public static object? Ast_MessageHistory(object? kind, IExchange exchange)

Ast_Min(object?, object?)

Returns the minimum of two values.

public static object? Ast_Min(object? a, object? b)

Ast_Now()

Returns the current UTC date/time.

public static object? Ast_Now()

Ast_NullCoalesce(object?, object?)

Returns the left operand if it is not null; otherwise returns the right operand (null-coalescing).

public static object? Ast_NullCoalesce(object? left, object? right)

Ast_Replace(object?, object?, object?)

Replaces all occurrences of a substring.

public static object? Ast_Replace(object? value, object? oldStr, object? newStr)

Ast_ResolvePropertyPath(object?, string)

Resolves a property path on an object via AST delegation.

public static object? Ast_ResolvePropertyPath(object? obj, string path)

Ast_Round(object?, object?)

Rounds a number to the specified number of digits.

public static object? Ast_Round(object? value, object? digits)

Ast_StartsWith(object?, object?)

Checks if a string starts with a prefix (case-insensitive).

public static object? Ast_StartsWith(object? value, object? prefix)

Ast_Stats(object?, object?, IExchange)

Evaluates stats(target, metric) — endpoint statistics as a value in the expression

public static object? Ast_Stats(object? target, object? metric, IExchange exchange)

Ast_Substring(object?, object?, object?)

Extracts a substring.

public static object? Ast_Substring(object? value, object? start, object? length)

Ast_Sum(object?)

Sums all numeric values in a collection.

public static object? Ast_Sum(object? value)

Ast_Trim(object?)

Trims whitespace from a string.

public static object? Ast_Trim(object? value)

Ast_TryConvertToBool(object?, out bool)

Attempts to convert a value to a boolean via AST delegation.

public static bool Ast_TryConvertToBool(object? value, out bool result)

Ast_Upper(object?)

Converts a string to upper case.

public static object? Ast_Upper(object? value)

Ast_Uuid(object?)

A fresh GUID as text. Impure by design: every evaluation yields a new value

public static object? Ast_Uuid(object? format)

Ast_XPath(object?, IExchange)

Evaluates an xpath() function via AST delegation.

public static object? Ast_XPath(object? path, IExchange exchange)

Ast_XPathFrom(object?, object?, IExchange)

Evaluates the two-argument xpath(path, source), which reads the source instead of the

public static object? Ast_XPathFrom(object? path, object? source, IExchange exchange)

ClearAllCaches()

Clears all caches and resets metric counters.

public static void ClearAllCaches()

ClearCachesForContext(string)

Clears all cache entries belonging to the specified context.

public static void ClearCachesForContext(string contextId)

ClearPropertyResolverCache()

Clears the property resolver cache.

public static void ClearPropertyResolverCache()

ClearTemplateCache()

Clears the template cache.

public static void ClearTemplateCache()

ClearValueExpressionCache()

Clears the value expression cache.

public static void ClearValueExpressionCache()

DebugLog(string)

Writes a debug message to the console when debug mode is enabled.

public static void DebugLog(string message)

DebugPrintExpressionTree(Expression, string, bool)

Prints an expression tree to the console with indentation reflecting nesting depth.

public static void DebugPrintExpressionTree(Expression expression, string indent = "", bool isRoot = true)

GetCacheStatistics()

Returns cache statistics with performance metrics.

public static CacheStatistics GetCacheStatistics()

GetCompiledPropertyResolver(string, string?)

Gets a compiled delegate for resolving properties.

public static Func<object?, string, object?> GetCompiledPropertyResolver(string expression, string? contextId = null)

GetCompiledTemplate(string, string?)

Gets a compiled delegate for processing a template string.

public static Func<IExchange, string> GetCompiledTemplate(string template, string? contextId = null)

GetCompiledValueExpression(string, string?)

Gets a compiled delegate for obtaining values from an exchange.

public static Func<IExchange, object?> GetCompiledValueExpression(string expression, string? contextId = null)

GetCompiledValueExpressionWithAst(string, string?)

Gets a compiled delegate for obtaining values using the AST parser.

public static Func<IExchange, object?> GetCompiledValueExpressionWithAst(string expression, string? contextId = null)

Initialize(bool)

Initializes the environment with UTF-8 output and optional debug mode.

public static void Initialize(bool enableDebug = true)

IsTemplate(string)

Reports whether a string is a ${...} template rather than a bare expression.

public static bool IsTemplate(string expression)

ParseLiteral(string)

Parses a literal value

public static object? ParseLiteral(string value)

ProcessTemplate(string, IExchange, string?)

Processes a template using a cached compiled delegate.

public static string ProcessTemplate(string template, IExchange exchange, string? contextId = null)

RegisterPrefixResolver(string, Func<IExchange, string, object?>)

Registers a resolver for a custom property prefix. The prefix

public static void RegisterPrefixResolver(string prefix, Func<IExchange, string, object?> resolver)

ResolveExpression(string, IExchange)

Evaluates an expression in the context of an exchange, by the same engine as every other position: a text with

public static object? ResolveExpression(string expression, IExchange exchange)

ResolveTypedOrTemplate(string, IExchange)

Resolves a template with type preservation for single expressions.

public static object? ResolveTypedOrTemplate(string template, IExchange exchange)

SetDebugMode(bool)

Enables or disables debug output.

public static void SetDebugMode(bool enabled)

SetLogger(ILogger?)

Sets an optional logger for expression resolution warnings (missing headers, properties, etc.).

public static void SetLogger(ILogger? logger)

SetLoggerFactory(ILoggerFactory?)

Sets an optional logger factory; creates a logger named "redb.Route.Expressions".

public static void SetLoggerFactory(ILoggerFactory? factory)

SetUtf8Output()

Sets the console output encoding to UTF-8.

public static void SetUtf8Output()

TryConvertToBool(object?, out bool)

Converts a value to a boolean by the single DSL truthiness rule

public static bool TryConvertToBool(object? value, out bool result)

TryConvertToDouble(object?, out double)

Attempts to convert a value to a double. Public wrapper for AST function implementations.

public static bool TryConvertToDouble(object? value, out double result)

UnregisterPrefixResolver(string)

Removes a previously registered prefix resolver. Returns true

public static bool UnregisterPrefixResolver(string prefix)

Remarks

Expressions are evaluated synchronously, so the content functions read the whole content synchronously: they suit
small parts (a text note, a short XML). Large files are for the attachment steps and the connectors.