Class StringExpression

Assembly: redb.Route.dll

Expression that evaluates a string expression template via .
Supports ${...} template interpolation and raw expression strings.

Unifies the two expression worlds: typed objects and string-based
${...} templates. Inherits all predicate methods from
(isEqualTo, contains, isGreaterThan, etc.), so string expressions can be used anywhere
an is expected.


// In RouteBuilder:
.SetBody(Expr("${header.source}"))
.Filter(Expr("${header.amount}").isGreaterThan(1000))
.SetHeader("full", Expr("${header.first} ${header.last}"))

public sealed class StringExpression : Expression, IExpression

Inheritance

Object→Expression→StringExpression

Implements

Inherited Members

Properties

Template

Gets the original expression template string.

public string Template { get; }

Methods

Evaluate<T>(IExchange)

Evaluates the expression and returns the result cast to T.

public override T Evaluate<T>(IExchange exchange)

SetValue(IExchange, object)

String expressions are read-only — they compute a value but have no target to write to.

public override void SetValue(IExchange exchange, object value)

ToString()

Returns a string that represents the current object.

public override string ToString()

ToTemplateString()

Serializes this expression to a ${...} template string suitable for URI parameters.

public override string ToTemplateString()

Constructors

StringExpression(string)

Initializes a new instance with the specified expression template.