Class PerspectiveExpression
java.lang.Object
com.inductiveautomation.perspective.gateway.binding.PerspectiveExpression
- All Implemented Interfaces:
InteractionListener
,ExpressionSourceStackMonitor
- Direct Known Subclasses:
PerspectiveTransformExpression
Helper class that simplifies the creation and proper evaluation of expressions that execute in and around the
binding / transform system.
Also simplifies the lifecycle so the user doesn't need to worry about the difference between startup/shutdown and connect/disconnect
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
PerspectiveExpression
(BindingContext bindingContext, Expression expression, List<PropertyReference> references) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
childInteractionUpdated
(List<Object> sourceStack) static PerspectiveExpression
create
(BindingContext context, String source) void
Submits evaluation task to the executorexecute()
Synchronously calls execute on the expression, on calling thread.void
shutdown()
void
startup
(Consumer<QualifiedValue> expressionValueCallback) void
startup
(Consumer<QualifiedValue> expressionValueCallback, Function<ExpressionException, QualifiedValue> errorHandler) Connects and starts up the underlying expression.
-
Field Details
-
PARSER
-
-
Constructor Details
-
PerspectiveExpression
protected PerspectiveExpression(BindingContext bindingContext, Expression expression, List<PropertyReference> references) - Parameters:
bindingContext
- The binding contextexpression
- The expression to evaluate
-
-
Method Details
-
create
public static PerspectiveExpression create(BindingContext context, String source) throws ConfigurationException - Throws:
ConfigurationException
-
execute
Synchronously calls execute on the expression, on calling thread.- Throws:
ExpressionException
-
resolveReferences
-
startup
-
startup
public void startup(Consumer<QualifiedValue> expressionValueCallback, Function<ExpressionException, QualifiedValue> errorHandler) Connects and starts up the underlying expression.- Parameters:
expressionValueCallback
- Callback that will be invoked when the expression produces a value. Will be called at least once, meaning that the initial value will be produced immediately.errorHandler
- Will be invoked if the expression throws, must create a qualified value to use. Single-arg constructor just returnsQualifiedValue.EXPRESSION_EVAL_ERROR
-
shutdown
public void shutdown() -
childInteractionUpdated
- Specified by:
childInteractionUpdated
in interfaceExpressionSourceStackMonitor
-
childInteractionUpdated
public void childInteractionUpdated()- Specified by:
childInteractionUpdated
in interfaceInteractionListener
-
evaluateExpression
public void evaluateExpression()Submits evaluation task to the executor
-