SignalReplay
final class SignalReplay
Package: dev.joid.lib.signal.replay · Module: core · Source: SignalReplay.java
Entry point of the replay that turns a plain value passed to a setter into a signal that follows the signals its expression read.
Description
Section titled “Description”When a setter receives a plain value, Signal.from(value) asks SignalReplay whether signals were read right before.
If they were, it finds the calling line in the stack, reads its bytecode, isolates the instructions that computed the argument and runs them again after each change of those signals.
When it cannot follow the expression, the value stays fixed and dev mode prints one warning per line, with the reason and the fix.
Learn more
Section titled “Learn more”Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
Supplier<T> | replay(T value) static | Returns a supplier that computes again the expression that produced value, or null when no signal was read or when JOID cannot follow it. |
void | run(Object owner, Object parent, Runnable runnable) static | Runs runnable with read tracking on, for the code of owner (a UI or a node) and of parent (the UI of a node), so the replay can find the object that the bytecode calls this. |
void | reset() static | Forgets the reads and the call order recorded on the calling thread. |
void | clear() static | Forgets every bytecode analysis kept in memory, so the next replay reads the classes again. |
void | warn(SignalReplayCall call, List | Prints the dev warning of a line that JOID cannot follow, once per line: the file and line, the setter, the signals read, the reason, the value that stays and the advice. |
Method details
Section titled “Method details”replay
Section titled “replay”<T> Supplier<T> replay(T value) static
Returns a supplier that computes again the expression that produced value, or null when no signal was read or when JOID cannot follow it.
void run(Object owner, Object parent, Runnable runnable) static
Runs runnable with read tracking on, for the code of owner (a UI or a node) and of parent (the UI of a node), so the replay can find the object that the bytecode calls this.
JOID calls it around init(), bodies, listeners, tasks, shortcuts and watches.
void reset() static
Forgets the reads and the call order recorded on the calling thread.
void clear() static
Forgets every bytecode analysis kept in memory, so the next replay reads the classes again.
void warn(SignalReplayCall call, List<String> nameList, int readCount, SignalReplayException exception, Object value) static
Prints the dev warning of a line that JOID cannot follow, once per line: the file and line, the setter, the signals read, the reason, the value that stays and the advice.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
