Class RangeValidatingInputTable
- All Implemented Interfaces:
InputTableUpdater
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 Summary
Modifier and TypeMethodDescriptionvoidWritenewDatato this table.voidaddAsync(Table newData, InputTableStatusListener listener) WritenewDatato this table.voidDelete the keys contained intablefrom this input table.voiddeleteAsync(Table table, InputTableStatusListener listener) Delete the keys contained in table from this input table.@Nullable StringgetColumnRestrictions(String columnName) 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.Gets the names of the key columns.Get the underlying Table definition (which includes the names and types of all of the columns).Gets the names of the value columns.booleanReturns true if the specified column exists in this InputTable.booleanReturns true if the specified column is a key.static TableWrapinput, which must be an input table into a new input table that validates that the values incolumnare within the range([min, max].voidvalidateAddOrModify(Table tableToApply) Helper to check if a table is compatible with this table, so that it could be added as contents.voidvalidateDelete(Table tableToDelete) Validates that the given table definition is suitable to be passed toInputTableUpdater.delete(Table).
-
Method Details
-
make
Wrapinput, which must be an input table into a new input table that validates that the values incolumnare within the range([min, max].- Parameters:
input- the table to wrapcolumn- the column to validate, must be an integer typemin- the minimum value allowed, inclusivemax- the maximum value allowed, inclusive- Returns:
- a new input table that validates the range of
column
-
getKeyNames
Description copied from interface:InputTableUpdaterGets the names of the key columns.- Specified by:
getKeyNamesin interfaceInputTableUpdater- Returns:
- a list with the names of the key columns of this input table
-
getValueNames
Description copied from interface:InputTableUpdaterGets the names of the value columns. By default, any column not marked as a key column is a value column.- Specified by:
getValueNamesin interfaceInputTableUpdater- Returns:
- a list with the names of the value columns of this input table
-
getColumnRestrictions
Description copied from interface:InputTableUpdaterIf 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:
getColumnRestrictionsin interfaceInputTableUpdater- 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
Description copied from interface:InputTableUpdaterGet the underlying Table definition (which includes the names and types of all of the columns).- Specified by:
getTableDefinitionin interfaceInputTableUpdater- Returns:
- the TableDefinition for our user-visible table
-
validateAddOrModify
Description copied from interface:InputTableUpdaterHelper to check if a table is compatible with this table, so that it could be added as contents.- Specified by:
validateAddOrModifyin interfaceInputTableUpdater- Parameters:
tableToApply- the table to check if it can used to add or modify this input table
-
validateDelete
Description copied from interface:InputTableUpdaterValidates that the given table definition is suitable to be passed toInputTableUpdater.delete(Table).- Specified by:
validateDeletein interfaceInputTableUpdater- Parameters:
tableToDelete- The definition of the table to delete
-
add
Description copied from interface:InputTableUpdaterWritenewDatato 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 listeneror any othernotification-dispatched callback dispatched by this InputTable'supdate graph. It may be suitable to delete from another update graph if doing so does not introduce any cycles.- Specified by:
addin interfaceInputTableUpdater- Parameters:
newData- The data to write to this table- Throws:
IOException- If there is an error writing the data
-
addAsync
Description copied from interface:InputTableUpdaterWritenewDatato this table. Added rows with keys that match existing rows replace those rows, if supported.The callback to
listenerwill 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 listeneror any othernotification-dispatched callback as long astableis alreadysatisfiedon the current cycle.- Specified by:
addAsyncin interfaceInputTableUpdater- Parameters:
newData- The data to write to this tablelistener- The listener for asynchronous results
-
delete
Description copied from interface:InputTableUpdaterDelete the keys contained intablefrom 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 listeneror any othernotification-dispatched callback dispatched by this InputTable'supdate graph. It may be suitable to delete from another update graph if doing so does not introduce any cycles.- Specified by:
deletein interfaceInputTableUpdater- Parameters:
table- The rows to delete- Throws:
IOException- If a problem occurred while deleting the rows.
-
deleteAsync
Description copied from interface:InputTableUpdaterDelete the keys contained in table from this input table.The callback to
listenerwill 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 listeneror any othernotification-dispatched callback as long astableis alreadysatisfiedon the current cycle.- Specified by:
deleteAsyncin interfaceInputTableUpdater- Parameters:
table- Table containing the rows to delete
-
isKey
Description copied from interface:InputTableUpdaterReturns true if the specified column is a key.- Specified by:
isKeyin interfaceInputTableUpdater- Parameters:
columnName- the column to interrogate- Returns:
- true if columnName is a key column, false otherwise
-
hasColumn
Description copied from interface:InputTableUpdaterReturns true if the specified column exists in this InputTable.- Specified by:
hasColumnin interfaceInputTableUpdater- Parameters:
columnName- the column to interrogate- Returns:
- true if columnName exists in this InputTable
-