Class RangeValidatingInputTable

java.lang.Object
io.deephaven.server.table.inputtables.RangeValidatingInputTable
All Implemented Interfaces:
InputTableUpdater

@TestUseOnly public class RangeValidatingInputTable extends Object implements InputTableUpdater
This is an example of an InputTableUpdater that validates that the values in an Integer column are within a given range.

This class wraps an existing input table, and before performing the underlying validation performs its own validation on the range of the column.

This class is intended for testing and demonstrating validation functionality, it is not production ready and may be changed or removed at any time.

  • Method Details

    • make

      public static Table make(Table input, String column, int min, int max)
      Wrap input, which must be an input table into a new input table that validates that the values in column are within the range ([min, max].
      Parameters:
      input - the table to wrap
      column - the column to validate, must be an integer type
      min - the minimum value allowed, inclusive
      max - the maximum value allowed, inclusive
      Returns:
      a new input table that validates the range of column
    • getKeyNames

      public List<String> getKeyNames()
      Description copied from interface: InputTableUpdater
      Gets the names of the key columns.
      Specified by:
      getKeyNames in interface InputTableUpdater
      Returns:
      a list with the names of the key columns of this input table
    • getValueNames

      public List<String> getValueNames()
      Description copied from interface: InputTableUpdater
      Gets the names of the value columns. By default, any column not marked as a key column is a value column.
      Specified by:
      getValueNames in interface InputTableUpdater
      Returns:
      a list with the names of the value columns of this input table
    • getColumnRestrictions

      @Nullable public @Nullable String getColumnRestrictions(String columnName)
      Description copied from interface: InputTableUpdater
      If there are client-side defined restrictions on this column; return them as a JSON string to be interpreted by the client for properly displaying the edit field.
      Specified by:
      getColumnRestrictions in interface InputTableUpdater
      Parameters:
      columnName - the column name to query
      Returns:
      a string representing the restrictions for this column, or null if no client-side restrictions are supplied for this column
    • getTableDefinition

      public TableDefinition getTableDefinition()
      Description copied from interface: InputTableUpdater
      Get the underlying Table definition (which includes the names and types of all of the columns).
      Specified by:
      getTableDefinition in interface InputTableUpdater
      Returns:
      the TableDefinition for our user-visible table
    • validateAddOrModify

      public void validateAddOrModify(Table tableToApply)
      Description copied from interface: InputTableUpdater
      Helper to check if a table is compatible with this table, so that it could be added as contents.
      Specified by:
      validateAddOrModify in interface InputTableUpdater
      Parameters:
      tableToApply - the table to check if it can used to add or modify this input table
    • validateDelete

      public void validateDelete(Table tableToDelete)
      Description copied from interface: InputTableUpdater
      Validates that the given table definition is suitable to be passed to InputTableUpdater.delete(Table).
      Specified by:
      validateDelete in interface InputTableUpdater
      Parameters:
      tableToDelete - The definition of the table to delete
    • add

      public void add(Table newData) throws IOException
      Description copied from interface: InputTableUpdater
      Write newData to this table. Added rows with keys that match existing rows will instead replace those rows, if supported.

      This method will block until the add is "completed", where the definition of "completed" is implementation dependenent.

      For implementations where "completed" means "visible in the next update graph cycle", this method is not suitable for use from a table listener or any other notification-dispatched callback dispatched by this InputTable's update graph. It may be suitable to delete from another update graph if doing so does not introduce any cycles.

      Specified by:
      add in interface InputTableUpdater
      Parameters:
      newData - The data to write to this table
      Throws:
      IOException - If there is an error writing the data
    • addAsync

      public void addAsync(Table newData, InputTableStatusListener listener)
      Description copied from interface: InputTableUpdater
      Write newData to this table. Added rows with keys that match existing rows replace those rows, if supported.

      The callback to listener will happen when the add has "completed", where the definition of "completed" is implementation dependenent. It's possible that the callback happens immediately on the same thread.

      This method will not block, and can be safely used from a table listener or any other notification-dispatched callback as long as table is already satisfied on the current cycle.

      Specified by:
      addAsync in interface InputTableUpdater
      Parameters:
      newData - The data to write to this table
      listener - The listener for asynchronous results
    • delete

      public void delete(Table table) throws IOException
      Description copied from interface: InputTableUpdater
      Delete the keys contained in table from this input table.

      This method will block until the delete is "completed", where the definition of "completed" is implementation dependenent.

      For implementations where "completed" means "visible in the next update graph cycle", this method is not suitable for use from a table listener or any other notification-dispatched callback dispatched by this InputTable's update graph. It may be suitable to delete from another update graph if doing so does not introduce any cycles.

      Specified by:
      delete in interface InputTableUpdater
      Parameters:
      table - The rows to delete
      Throws:
      IOException - If a problem occurred while deleting the rows.
    • deleteAsync

      public void deleteAsync(Table table, InputTableStatusListener listener)
      Description copied from interface: InputTableUpdater
      Delete the keys contained in table from this input table.

      The callback to listener will happen when the delete has "completed", where the definition of "completed" is implementation dependenent. It's possible that the callback happens immediately on the same thread.

      This method will not block, and can be safely used from a table listener or any other notification-dispatched callback as long as table is already satisfied on the current cycle.

      Specified by:
      deleteAsync in interface InputTableUpdater
      Parameters:
      table - Table containing the rows to delete
    • isKey

      public boolean isKey(String columnName)
      Description copied from interface: InputTableUpdater
      Returns true if the specified column is a key.
      Specified by:
      isKey in interface InputTableUpdater
      Parameters:
      columnName - the column to interrogate
      Returns:
      true if columnName is a key column, false otherwise
    • hasColumn

      public boolean hasColumn(String columnName)
      Description copied from interface: InputTableUpdater
      Returns true if the specified column exists in this InputTable.
      Specified by:
      hasColumn in interface InputTableUpdater
      Parameters:
      columnName - the column to interrogate
      Returns:
      true if columnName exists in this InputTable