Class TableToJSON.Builder

java.lang.Object
com.illumon.iris.db.tables.utils.TableToJSON.Builder
Enclosing class:
TableToJSON

public static class TableToJSON.Builder extends Object
Create a builder for processing Deephaven table data into string output
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • autoValueMapping

      public TableToJSON.Builder autoValueMapping(boolean autoValueMapping)
      Enables or disables automatic value mapping (true by default). If auto value mapping is enabled, any column that was not defined [either by excludeColumn or mapColumn] is automatically mapped to a JSON field of the same name.
      Parameters:
      autoValueMapping - should automatic value mapping be enabled
      Returns:
      this builder
    • ignoreMissingColumns

      public TableToJSON.Builder ignoreMissingColumns(boolean ignoreMissingColumns)
      Permit the builder to silently ignore any columns not specified. False by default. If auto value mapping is enabled, this has no effect.
      Parameters:
      ignoreMissingColumns - True if the builder should ignore table columns with no specified behavior. false if the builder should throw an exception if columns are found with no mapping.
      Returns:
      this builder
    • excludeColumn

      public TableToJSON.Builder excludeColumn(@NotNull String column)
      Indicates that a column is unmapped, and therefore not included in the output. You may not exclude a column that has already been excluded or mapped.
      Parameters:
      column - name of the column in the output table
      Returns:
      this builder
    • mapColumn

      public TableToJSON.Builder mapColumn(@NotNull String column)
      Map a Deephaven column to an output field of the same name. You may map the same column to multiple output fields, but may only map a given field once.
      Parameters:
      column - The name of the Deephaven column to export
      Returns:
      this builder
    • mapColumn

      public TableToJSON.Builder mapColumn(@NotNull String column, @NotNull String field)
      Map a Deephaven column to a specified output field. You may map multiple output fields from a single column., but may only map a given field once.
      Parameters:
      column - The name of the Deephaven column to export
      field - The name of the field to produce
      Returns:
      this builder
    • addCustomFunction

      public TableToJSON.Builder addCustomFunction(@NotNull String field, @NotNull TableToJSON.CustomFunction<?> func)
      Apply a generic function transforming data from Deephaven into a generic publishable format. The output object will then be processed by an implementing class into its final form.
      Parameters:
      field - The name of the field to be produced by the function
      func - A CustomFunction object containing the desired output type and the function that will produce the desired publishable output, given an index row number and whether or not this is a 'remove' operation or not (as removals must use 'getPrev' instead of 'get' to retrieve their data from a source).
      Returns:
      this builder
    • timestampFieldName

      public TableToJSON.Builder timestampFieldName(String timestampFieldName)
      Include a timestamp indicating when this data was processed.
      Parameters:
      timestampFieldName - The name of the field to show a timestamp, or null for no timestamp.
      Returns:
      this builder
    • nestedObjectDelimiter

      public TableToJSON.Builder nestedObjectDelimiter(String nestedObjectDelimiter)
      The delimiter used to generate nested output objects from column names.
      Parameters:
      nestedObjectDelimiter - the delimiter string/character.
      Returns:
      this builder
    • outputNulls

      public TableToJSON.Builder outputNulls(boolean outputNulls)
      Whether to output null values.
      Parameters:
      outputNulls - to output nulls
      Returns:
      this builder
    • buildFactory

      public Function<Table,TableToJSON> buildFactory()
      Create a factory according to the specifications of this builder.
      Returns:
      a factory for creating a StringTableWriterAdapter from a TableWriter