Class PrefixExpressionExtensions
- Namespace
- Albatross.Expression.Nodes
- Assembly
- Albatross.Expression.dll
Extension methods for IPrefixExpression that provide convenient operand access and validation. Simplifies getting values from prefix expression operands with type conversion and error handling.
public static class PrefixExpressionExtensions
- Inheritance
-
PrefixExpressionExtensions
- Inherited Members
Methods
GetRequiredStringValue(IPrefixExpression, int, Func<string, object>)
Gets a required non-empty string value of an operand at the specified index. Trims whitespace and throws an exception if the result is empty.
public static string GetRequiredStringValue(this IPrefixExpression expression, int index, Func<string, object> context)
Parameters
expressionIPrefixExpressionThe prefix expression containing the operands.
indexintThe zero-based index of the operand.
contextFunc<string, object>Function to resolve variable values during evaluation.
Returns
- string
The trimmed string value of the operand.
Exceptions
- OperandException
Thrown when the index is out of range or the string value is empty after trimming.
GetRequiredStringValue(List<object>, int)
Gets a required non-empty string value from a list at the specified index. Trims whitespace and throws an exception if the result is empty.
public static string GetRequiredStringValue(this List<object> list, int index)
Parameters
Returns
- string
The trimmed string value at the specified index.
Exceptions
- OperandException
Thrown when the string value is empty after trimming.
- ArgumentOutOfRangeException
Thrown when the index is out of range.
GetRequiredStringValueAsync(IPrefixExpression, int, Func<string, Task<object>>)
Asynchronously gets a required non-empty string value of an operand at the specified index. Trims whitespace and throws an exception if the result is empty.
public static Task<string> GetRequiredStringValueAsync(this IPrefixExpression expression, int index, Func<string, Task<object>> context)
Parameters
expressionIPrefixExpressionThe prefix expression containing the operands.
indexintThe zero-based index of the operand.
contextFunc<string, Task<object>>Async function to resolve variable values during evaluation.
Returns
Exceptions
- OperandException
Thrown when the index is out of range or the string value is empty after trimming.
GetStringValue(IPrefixExpression, int, Func<string, object>)
Gets the string representation of an operand value at the specified index.
public static string GetStringValue(this IPrefixExpression expression, int index, Func<string, object> context)
Parameters
expressionIPrefixExpressionThe prefix expression containing the operands.
indexintThe zero-based index of the operand.
contextFunc<string, object>Function to resolve variable values during evaluation.
Returns
- string
The string representation of the operand value.
Exceptions
- OperandException
Thrown when the index is out of range.
GetStringValueAsync(IPrefixExpression, int, Func<string, Task<object>>)
Asynchronously gets the string representation of an operand value at the specified index.
public static Task<string> GetStringValueAsync(this IPrefixExpression expression, int index, Func<string, Task<object>> context)
Parameters
expressionIPrefixExpressionThe prefix expression containing the operands.
indexintThe zero-based index of the operand.
contextFunc<string, Task<object>>Async function to resolve variable values during evaluation.
Returns
Exceptions
- OperandException
Thrown when the index is out of range.
GetValue(IPrefixExpression, int, Func<string, object>)
Gets the evaluated value of an operand at the specified index.
public static object GetValue(this IPrefixExpression expression, int index, Func<string, object> context)
Parameters
expressionIPrefixExpressionThe prefix expression containing the operands.
indexintThe zero-based index of the operand.
contextFunc<string, object>Function to resolve variable values during evaluation.
Returns
- object
The evaluated value of the operand.
Exceptions
- OperandException
Thrown when the index is out of range.
GetValueAsync(IPrefixExpression, int, Func<string, Task<object>>)
Asynchronously gets the evaluated value of an operand at the specified index.
public static Task<object> GetValueAsync(this IPrefixExpression expression, int index, Func<string, Task<object>> context)
Parameters
expressionIPrefixExpressionThe prefix expression containing the operands.
indexintThe zero-based index of the operand.
contextFunc<string, Task<object>>Async function to resolve variable values during evaluation.
Returns
Exceptions
- OperandException
Thrown when the index is out of range.
GetValues(IPrefixExpression, Func<string, object>)
Gets all operand values as a list by evaluating each operand.
public static List<object> GetValues(this IPrefixExpression expression, Func<string, object> context)
Parameters
expressionIPrefixExpressionThe prefix expression containing the operands.
contextFunc<string, object>Function to resolve variable values during evaluation.
Returns
GetValuesAsync(IPrefixExpression, Func<string, Task<object>>)
Asynchronously gets all operand values as a list by evaluating each operand.
public static Task<List<object>> GetValuesAsync(this IPrefixExpression expression, Func<string, Task<object>> context)
Parameters
expressionIPrefixExpressionThe prefix expression containing the operands.
contextFunc<string, Task<object>>Async function to resolve variable values during evaluation.