The ValueExpression companion object provides a mechanism to extract elements from a ValueExpression instance. It defines the unapply method to enable pattern matching and decomposition of ValueExpression objects.
The extraction operation retrieves the underlying Eager and an optional name, if available. It handles two main cases:
For instances of Literal, it extracts the Eager value along with None for the optional name.
For other cases, it extracts the Eager value along with its associated optional name.
Creates a ValueExpression instance by wrapping the provided Valuable object. NOTE: client code should not normally invoke this method directly. Prefer to use the Expression.apply method for creating ValueExpression instances.
Creates a ValueExpression instance by wrapping the provided Valuable object. NOTE: client code should not normally invoke this method directly. Prefer to use the Expression.apply method for creating ValueExpression instances.
Value parameters
v
the Eager instance to be encapsulated within a ValueExpression.
Attributes
Returns
a ValueExpression representing the provided Eager object, with its rendered representation.
Extracts components from a ValueExpression instance, enabling pattern matching.
Extracts components from a ValueExpression instance, enabling pattern matching.
The unapply method decomposes a ValueExpression into its constituent Valuable and an optional name. For instances of Literal, the optional name is always None.
Value parameters
f
the ValueExpression to be decomposed.
Attributes
Returns
an Option containing a tuple of the Valuable and an optional name derived from the given ValueExpression. If the input cannot be decomposed, returns None.