Class FunctionGeneratedTableFactory
The table will run by regenerating the full values (using the tableGenerator Function passed in). The resultant table's values are copied into the result table and appropriate listener notifications are fired.
All the rows in the output table are modified on every tick, even if no actual changes occurred. The output table also has a contiguous RowSet.
The generator function must produce a V2 table, and the table definition must not change between invocations.
If you are transforming a table, you should generally prefer to use the regular table operations as opposed to this factory, because they are capable of performing some operations incrementally. However, for small tables this might prove to require less development effort.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Table
Create a table that refreshes based on the value of your function, automatically called every refreshIntervalMs.static Table
Create a table that refreshes based on the value of your function, automatically called in a dependency-respecting way when at least one of thesourceTables
tick.
-
Method Details
-
create
Create a table that refreshes based on the value of your function, automatically called every refreshIntervalMs.- Parameters:
tableGenerator
- a function returning a table to copy into the output table- Returns:
- a ticking table (assuming sourceTables have been specified) generated by tableGenerator
-
create
public static Table create(@NotNull @NotNull Supplier<Table> tableGenerator, @NotNull @NotNull Table... sourceTables) Create a table that refreshes based on the value of your function, automatically called in a dependency-respecting way when at least one of thesourceTables
tick.Note that the
tableGenerator
may access data in thesourceTables
but should not perform further table operations on them without careful handling. Table operations may be memoized, and it is possible that a table operation will return a table created by a previous invocation of the same operation. Since that result will not have been included in thesourceTables
, it's not automatically treated as a dependency for purposes of determining when it's safe to invoketableGenerator
, allowing races to exist between accessing the operation result and that result's own update processing. It's best to include all dependencies directly insourceTables
, or only compute on-demand inputs under aLivenessScope
.- Parameters:
tableGenerator
- a function returning a table to copy into the output tablesourceTables
- The query engine does not know the details of your function inputs. If you are dependent on a ticking table tables in your tableGenerator function, you can add it to this list so that the function will be recomputed on each tick.- Returns:
- a ticking table (assuming sourceTables have been specified) generated by tableGenerator
-