ValueExpression class

Represents a property which is an object of any kind or a string expression.

Extends

Remarks

If the value is

  • a string with '=' prefix then the string is treated as an expression to resolve to a string.
  • a string without '=' then value is treated as string with string interpolation.
  • You can escape the '=' prefix by putting a backslash. Examples: prop = "Hello @{user.name}" => "Hello Joe" prop = "=length(user.name)" => "3" prop = "=user.name" => "Joe" prop = "=user" => "=user".

Constructors

ValueExpression(any | string | Expression)

Initializes a new instance of the ValueExpression class.

Inherited Properties

expressionText

Getes or sets the expression text to evaluate to get the value.

value

Gets or sets the raw value of the expression property.

Methods

setValue(any | string | Expression)

Set value as value expression.

Inherited Methods

getValue(object)

Get the value.

toExpression()

This will return the existing expression if the value is non-complex type.

toString()

Convert an expression property to string.

tryGetValue(object)

Try to Get the value.

Constructor Details

ValueExpression(any | string | Expression)

Initializes a new instance of the ValueExpression class.

new ValueExpression(value?: any | string | Expression)

Parameters

value

any | string | Expression

An object of any kind or a string expression.

Inherited Property Details

expressionText

Getes or sets the expression text to evaluate to get the value.

expressionText: string

Property Value

string

Inherited From ExpressionProperty.expressionText

value

Gets or sets the raw value of the expression property.

value: any

Property Value

any

Inherited From ExpressionProperty.value

Method Details

setValue(any | string | Expression)

Set value as value expression.

function setValue(value: any | string | Expression)

Parameters

value

any | string | Expression

Value to set.

Inherited Method Details

getValue(object)

Get the value.

function getValue(data: object): any

Parameters

data

object

Data to use for expression binding.

Returns

any

The value.

Remarks

An error will be thrown if value is an invalid expression.

Inherited From ExpressionProperty.getValue

toExpression()

This will return the existing expression if the value is non-complex type.

function toExpression(): Expression

Returns

The existing expression if the value is non-complex type.

Inherited From ExpressionProperty.toExpression

toString()

Convert an expression property to string.

function toString(): string

Returns

string

The converted string.

Inherited From ExpressionProperty.toString

tryGetValue(object)

Try to Get the value.

function tryGetValue(data: object): { error: Error, value: any }

Parameters

data

object

Data to use for expression binding.

Returns

{ error: Error, value: any }

the value or an error.

Inherited From ExpressionProperty.tryGetValue