Package com.illumon.iris.db.tables.utils
Class TableToJSON
java.lang.Object
com.illumon.iris.db.tables.utils.TableToJSON
public final class TableToJSON extends Object
this was copied from solace, combined abstract and concrete classes into one here.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TableToJSON.Builder
Create a builder for processing Deephaven table data into string outputstatic class
TableToJSON.CustomFunction<T>
protected static interface
TableToJSON.FieldProcessor
static interface
TableToJSON.FieldValueProvider<T>
protected class
TableToJSON.JSONFieldProcessor
protected static interface
TableToJSON.ProcessFunction
-
Constructor Summary
Constructors Constructor Description TableToJSON(Table source, Map<String,String> columnsToOutputFields, Map<String,TableToJSON.CustomFunction<?>> customFunctions, Set<String> excludedColumns, boolean autoValueMapping, boolean ignoreMissingColumns, String timestampFieldName, String nestedObjectDelimiter, boolean outputNulls)
-
Method Summary
Modifier and Type Method Description protected void
makeFieldProcessor(String fieldName, String columnName)
Create a field processor that translates a given column from its Deephaven row number to JSON.protected TableToJSON.FieldProcessor
makeTimestampProcessor(String fieldName)
List<String>
parseUpdate(Index toProcess, boolean isRemoval)
Convert the specified 'modified' rows from the update into JSON<T> List<T>
parseUpdate(Index toProcess, boolean isRemoval, Function<io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.node.ObjectNode,T> conversionFunction)
Convert the specified 'modified' rows from the update into JSON ObjectNodes, then transform into typeT
with the givenconversionFunction
.List<io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.node.ObjectNode>
parseUpdateToJsonNodes(Index toProcess, boolean isRemoval)
Convert the specified 'modified' rows from the update into JSON ObjectNodes.protected <T> void
storeCustomFunctionFieldProcessor(String fieldName, TableToJSON.CustomFunction<T> customFunction)
-
Constructor Details
-
Method Details
-
storeCustomFunctionFieldProcessor
protected <T> void storeCustomFunctionFieldProcessor(String fieldName, TableToJSON.CustomFunction<T> customFunction) -
makeFieldProcessor
Create a field processor that translates a given column from its Deephaven row number to JSON.- Parameters:
fieldName
- The name of the field in the output (if needed).columnName
- The Deephaven column to be translated into String format
-
makeTimestampProcessor
-
parseUpdate
Convert the specified 'modified' rows from the update into JSON- Parameters:
toProcess
- An Index indicating which rows were involved in this operationisRemoval
- Whether the Index is of removed rows- Returns:
- A List of Strings, each representing one modification
-
parseUpdateToJsonNodes
public List<io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.node.ObjectNode> parseUpdateToJsonNodes(Index toProcess, boolean isRemoval)Convert the specified 'modified' rows from the update into JSON ObjectNodes.- Parameters:
toProcess
- An Index indicating which rows were involved in this operationisRemoval
- Whether the Index is of removed rows- Returns:
- A List of ObjectNodes, each representing one modification
-
parseUpdate
public <T> List<T> parseUpdate(Index toProcess, boolean isRemoval, Function<io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.node.ObjectNode,T> conversionFunction)Convert the specified 'modified' rows from the update into JSON ObjectNodes, then transform into typeT
with the givenconversionFunction
.- Type Parameters:
T
- The data type into which the JSON ObjectNodes are converted.- Parameters:
toProcess
- An Index indicating which rows were involved in this operationisRemoval
- Whether the Index is of removed rowsconversionFunction
- A function to- Returns:
- A List of ObjectNodes, each representing one modification
-