Class PerspectiveExpression
- java.lang.Object
-
- com.inductiveautomation.perspective.gateway.binding.PerspectiveExpression
-
- All Implemented Interfaces:
InteractionListener
,ExpressionSourceStackMonitor
- Direct Known Subclasses:
PerspectiveTransformExpression
public class PerspectiveExpression extends java.lang.Object implements ExpressionSourceStackMonitor
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 Classes Modifier and Type Class Description protected static class
PerspectiveExpression.PerspectiveExpressionCommonContext
-
Field Summary
Fields Modifier and Type Field Description protected static ELParserHarness
PARSER
-
Constructor Summary
Constructors Modifier Constructor Description protected
PerspectiveExpression(BindingContext bindingContext, Expression expression, java.util.List<PropertyReference> references)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
childInteractionUpdated()
void
childInteractionUpdated(java.util.List<java.lang.Object> sourceStack)
static PerspectiveExpression
create(BindingContext context, java.lang.String source)
void
evaluateExpression()
Submits evaluation task to the executorQualifiedValue
execute()
Synchronously calls execute on the expression, on calling thread.java.util.Collection<PropertyReference>
resolveReferences()
void
shutdown()
void
startup(java.util.function.Consumer<QualifiedValue> expressionValueCallback)
void
startup(java.util.function.Consumer<QualifiedValue> expressionValueCallback, java.util.function.Function<ExpressionException,QualifiedValue> errorHandler)
Connects and starts up the underlying expression.
-
-
-
Field Detail
-
PARSER
protected static final ELParserHarness PARSER
-
-
Constructor Detail
-
PerspectiveExpression
protected PerspectiveExpression(BindingContext bindingContext, Expression expression, java.util.List<PropertyReference> references)
- Parameters:
bindingContext
- The binding contextexpression
- The expression to evaluate
-
-
Method Detail
-
create
public static PerspectiveExpression create(BindingContext context, java.lang.String source) throws ConfigurationException
- Throws:
ConfigurationException
-
execute
public QualifiedValue execute() throws ExpressionException
Synchronously calls execute on the expression, on calling thread.- Throws:
ExpressionException
-
resolveReferences
public java.util.Collection<PropertyReference> resolveReferences()
-
startup
public void startup(java.util.function.Consumer<QualifiedValue> expressionValueCallback)
-
startup
public void startup(java.util.function.Consumer<QualifiedValue> expressionValueCallback, java.util.function.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
public void childInteractionUpdated(java.util.List<java.lang.Object> sourceStack)
- Specified by:
childInteractionUpdated
in interfaceExpressionSourceStackMonitor
-
childInteractionUpdated
public void childInteractionUpdated()
- Specified by:
childInteractionUpdated
in interfaceInteractionListener
-
evaluateExpression
public void evaluateExpression()
Submits evaluation task to the executor
-
-