Class ExpressionDrivenValue<T>
java.lang.Object
com.inductiveautomation.perspective.gateway.driven.LockGuardedDrivenValue<T>
com.inductiveautomation.perspective.gateway.driven.ExpressionDrivenValue<T>
- Type Parameters:
T
- The type of the driven value
- All Implemented Interfaces:
DrivenValue<T>
- Direct Known Subclasses:
ExpressionDrivenQualifiedValue
,ExpressionDrivenStringValue
An ExpressionDrivenValue is a
LockGuardedDrivenValue
driven by a PerspectiveExpression
. The
injected valueChangedCallback
is called by a Thread
holding the injected lock object when
a new value is emitted from the expression and it passes validation. Derived classes get to decide what passing
validation means.-
Field Summary
FieldsFields inherited from class com.inductiveautomation.perspective.gateway.driven.LockGuardedDrivenValue
lock
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ExpressionDrivenValue
(Object lock, PerspectiveExpression expr, Runnable valueChangedCallback) -
Method Summary
Modifier and TypeMethodDescriptionFetch the current driven valueprotected boolean
Called after asserting that the calling thread holds the injected lock.protected boolean
Called after asserting that the calling thread holds the injected lock.protected abstract boolean
isValidValue
(QualifiedValue value) This method is called when a new value is emitted from the expression.protected Collection<PropertyReference>
void
shutdown()
Lifecycle hook to shut down the driven valuevoid
startup()
Lifecycle hook to start up the driven valueMethods inherited from class com.inductiveautomation.perspective.gateway.driven.LockGuardedDrivenValue
getAndClearInternal, isDirty, isReady, resolveReferences
-
Field Details
-
value
-
dirty
protected boolean dirty
-
-
Constructor Details
-
ExpressionDrivenValue
protected ExpressionDrivenValue(@Nonnull Object lock, @Nonnull PerspectiveExpression expr, @Nonnull Runnable valueChangedCallback)
-
-
Method Details
-
isValidValue
This method is called when a new value is emitted from the expression. If the value passes validation, the value is set, dirty bits are set, and the callback is notified. If the value does not pass validation, nothing happens and a debug message is logged.- Parameters:
value
- the latest value emitted from the expression- Returns:
- true if the value passes validation, false otherwise
-
isReadyInternal
protected boolean isReadyInternal()Description copied from class:LockGuardedDrivenValue
Called after asserting that the calling thread holds the injected lock.- Specified by:
isReadyInternal
in classLockGuardedDrivenValue<T>
- See Also:
-
isDirtyInternal
protected boolean isDirtyInternal()Description copied from class:LockGuardedDrivenValue
Called after asserting that the calling thread holds the injected lock.- Specified by:
isDirtyInternal
in classLockGuardedDrivenValue<T>
- See Also:
-
startup
public void startup()Description copied from interface:DrivenValue
Lifecycle hook to start up the driven value -
shutdown
public void shutdown()Description copied from interface:DrivenValue
Lifecycle hook to shut down the driven value -
resolveReferencesInternal
- Specified by:
resolveReferencesInternal
in classLockGuardedDrivenValue<T>
-
getAndClear
Description copied from interface:DrivenValue
Fetch the current driven value- Specified by:
getAndClear
in interfaceDrivenValue<T>
- Overrides:
getAndClear
in classLockGuardedDrivenValue<T>
- Returns:
- An
Optional
containing the current driven value, if present, or an empty Optional if the driven value is null / not present.
-