com.tibbo.aggregate.common.datatable

## Class TransformableDataTable

- java.lang.Object
- - com.tibbo.aggregate.common.datatable.TransformableDataTable

- All Implemented Interfaces:
    DataTable, AttributedObject, StringEncodable, java.lang.Iterable<DataRecord>

      public class TransformableDataTable
      extends java.lang.Object
      implements DataTable

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `TransformableDataTable.Processor`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransformableDataTable(DataTable origin)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `DataRecord` | `addRecord()` Adds new record to the table.
    `DataTable` | `addRecord(DataRecord record)` Adds new record to the table.
    `DataTable` | `addRecord(int index, DataRecord record)` Adds new record to the table at the specified index.
    `DataRecord` | `addRecord(java.lang.Object... fieldValues)` Adds new record to the table.
    `DataTable` | `addRecords(java.util.List<DataRecord> records)` Adds new records to the table.
    `void` | `append(DataTable src)`
    `boolean` | `applyCachedFormat(java.util.Optional<FormatCache> formatCache)`
    `java.util.Map<java.lang.String,DataRecord>` | `asMap(java.lang.String keyField)` Represent the table as the `ImmutableMap`, using on of the fields as a key, and `DataRecord` as the value
    `DataTable` | `clone()`
    `DataTable` | `cloneIfImmutable()`
    `void` | `close()`
    `int` | `compareTo(DataTable other)`
    `boolean` | `conform(TableFormat rf)`
    `java.lang.String` | `conformMessage(TableFormat rf)`
    `java.lang.String` | `dataAsString()`
    `java.lang.String` | `dataAsString(boolean showFieldNames, boolean showHiddenFields)`
    `java.lang.String` | `dataAsString(boolean showFieldNames, boolean showHiddenFields, boolean showPasswords)`
    `java.lang.String` | `encode()`
    `java.lang.String` | `encode(boolean useVisibleSeparators)`
    `java.lang.String` | `encode(ClassicEncodingSettings settings)`
    `java.lang.StringBuilder` | `encode(java.lang.StringBuilder finalSB, ClassicEncodingSettings settings, java.lang.Boolean isTransferEncode, java.lang.Integer encodeLevel)`
    `boolean` | `equals(java.lang.Object obj)`
    `java.lang.Integer` | `findIndex(DataRecord record)` Returns the index of the first occurrence of `record` in this Data Table, or null if this Data Table does not contain the specified record.
    `java.lang.Integer` | `findIndex(DataTableQuery query)`
    `java.lang.Integer` | `findIndex(java.lang.String field, java.lang.Object value)`
    `void` | `fixRecords()`
    `void` | `forEach(java.util.function.Consumer<? super DataRecord> action)`
    `java.lang.Object` | `get()` Returns value of first field in first record of the table.
    `java.lang.String` | `getDescription()` Returns human-readable description of the table.
    `java.lang.String` | `getEncodedData(ClassicEncodingSettings settings)`
    `java.lang.StringBuilder` | `getEncodedData(java.lang.StringBuilder finalSB, ClassicEncodingSettings settings, java.lang.Boolean isTransferEncode, java.lang.Integer encodeLevel)`
    `int` | `getFieldCount()` Returns number of fields in the table.
    `TableFormat` | `getFormat()` Returns format of the table.
    `FieldFormat` | `getFormat(int field)` Returns format of field with specified index.
    `FieldFormat` | `getFormat(java.lang.String name)` Returns format of field with specified name.
    `java.lang.Long` | `getId()` Returns table ID.
    `java.lang.String` | `getInvalidationMessage()`
    `java.lang.Integer` | `getQuality()`
    `DataRecord` | `getRecord(int number)` Returns record with specified index.
    `DataRecord` | `getRecordById(java.lang.String id)`
    `java.lang.Integer` | `getRecordCount()` Returns number of records in the table or null if the number of records is unknown.
    `java.util.List<DataRecord>` | `getRecords()` Deprecated.
    `java.util.Date` | `getTimestamp()`
    `java.lang.Object` | `getValue()`
    `boolean` | `hasField(java.lang.String field)`
    `int` | `hashCode()`
    `boolean` | `isImmutable()`
    `boolean` | `isInvalid()`
    `boolean` | `isOneCellTable()` Returns true if table has exactly one record and one field.
    `boolean` | `isSimple()`
    `java.util.Iterator<DataRecord>` | `iterator()`
    `java.util.Iterator<DataRecord>` | `iterator(int index)`
    `void` | `joinFormats()`
    `DataTable` | `makeImmutable()`
    `void` | `processDataTableRecursively(TransformableDataTable.Processor processor)`
    `DataRecord` | `rec()` Returns first record of the table.
    `DataRecord` | `removeRecord(int index)` Removes record with specified index from the table.
    `void` | `removeRecords(DataRecord rec)` Removes all records equal to the rec parameter from the table.
    `void` | `removeRecordsByIds(java.util.Collection<java.lang.String> ids)` Removes all records from the table which contain in ids.
    `DataRecord` | `removeRecordsByKey(java.lang.String keyField, java.lang.String value)` Removes the records for the specific `value` if `keyField` from this table if present.
    `void` | `reorderRecord(DataRecord record, int index)` Moves specified record to position specified by `index` argument.
    `DataRecord` | `select(DataTableQuery query)`
    `DataRecord` | `select(java.lang.String field, java.lang.Object value)`
    `java.util.List<DataRecord>` | `selectAll(DataTableQuery query)`
    `DataTable` | `setFormat(TableFormat format)` Sets new format for the table.
    `void` | `setId(java.lang.Long id)` Sets table ID.
    `void` | `setInvalidationMessage(java.lang.String invalidationMessage)`
    `void` | `setQuality(java.lang.Integer quality)`
    `DataTable` | `setRecord(int index, DataRecord record)` Replaces record at the specified index.
    `void` | `setTimestamp(java.util.Date timestamp)`
    `void` | `sort(java.util.Comparator<DataRecord> comparator)`
    `void` | `sort(DataTableSorter sorter)`
    `void` | `sort(java.lang.String field, boolean ascending)`
    `java.util.Spliterator<DataRecord>` | `spliterator()`
    `void` | `splitFormat()`
    `java.util.stream.Stream<DataRecord>` | `stream()`
    `void` | `swapRecords(int index1, int index2)` Swaps two records.
    `java.lang.String` | `toDefaultString()`
    `java.lang.String` | `toString()`
    `void` | `validate(Context context, ContextManager contextManager, CallerController caller)` Executes table validators to make sure table data is valid.
    `void` | `validateRecord(DataRecord record)` Executes validators of a specific record to make sure its data is valid.

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TransformableDataTable

          public TransformableDataTable(DataTable origin)

  - ### Method Detail

    - #### getRecordCount

          public java.lang.Integer getRecordCount()

      Description copied from interface: `DataTable`
      Returns number of records in the table or null if the number of records is unknown.
      Specified by:
        `getRecordCount` in interface `DataTable`

    - #### getFieldCount

          public int getFieldCount()

      Description copied from interface: `DataTable`
      Returns number of fields in the table.
      Specified by:
        `getFieldCount` in interface `DataTable`

    - #### getFormat

          public TableFormat getFormat()

      Description copied from interface: `DataTable`
      Returns format of the table.
      Specified by:
        `getFormat` in interface `DataTable`

    - #### setFormat

          public DataTable setFormat(TableFormat format)

      Description copied from interface: `DataTable`
      Sets new format for the table. Note, that resulting table is not checked for validity. Format of existing records may be incompatible with new format of table.
      Specified by:
        `setFormat` in interface `DataTable`

    - #### getFormat

          public FieldFormat getFormat(int field)

      Description copied from interface: `DataTable`
      Returns format of field with specified index.
      Specified by:
        `getFormat` in interface `DataTable`

    - #### getFormat

          public FieldFormat getFormat(java.lang.String name)

      Description copied from interface: `DataTable`
      Returns format of field with specified name.
      Specified by:
        `getFormat` in interface `DataTable`

    - #### applyCachedFormat

          public boolean applyCachedFormat(java.util.Optional<FormatCache> formatCache)

      Specified by:
        `applyCachedFormat` in interface `DataTable`

    - #### getId

          public java.lang.Long getId()

      Description copied from interface: `DataTable`
      Returns table ID.
      Specified by:
        `getId` in interface `DataTable`

    - #### setId

          public void setId(java.lang.Long id)

      Description copied from interface: `DataTable`
      Sets table ID.
      Specified by:
        `setId` in interface `DataTable`

    - #### hasField

          public boolean hasField(java.lang.String field)

      Specified by:
        `hasField` in interface `DataTable`

    - #### addRecords

          public DataTable addRecords(java.util.List<DataRecord> records)

      Description copied from interface: `DataTable`
      Adds new records to the table.
      Specified by:
        `addRecords` in interface `DataTable`

    - #### addRecord

          public DataTable addRecord(DataRecord record)

      Description copied from interface: `DataTable`
      Adds new record to the table.
      Specified by:
        `addRecord` in interface `DataTable`

    - #### addRecord

          public DataRecord addRecord(java.lang.Object... fieldValues)

      Description copied from interface: `DataTable`
      Adds new record to the table.
      Specified by:
        `addRecord` in interface `DataTable`

    - #### addRecord

          public DataTable addRecord(int index,
                                     DataRecord record)

      Description copied from interface: `DataTable`
      Adds new record to the table at the specified index.
      Specified by:
        `addRecord` in interface `DataTable`

    - #### addRecord

          public DataRecord addRecord()

      Description copied from interface: `DataTable`
      Adds new record to the table.
      Specified by:
        `addRecord` in interface `DataTable`

    - #### validate

          public void validate(Context context,
                               ContextManager contextManager,
                               CallerController caller)
                        throws DataTableException

      Description copied from interface: `DataTable`
      Executes table validators to make sure table data is valid. Throws an error if validation fails.
      Specified by:
        `validate` in interface `DataTable`
      Throws:
        `DataTableException`

    - #### validateRecord

          public void validateRecord(DataRecord record)
                              throws ValidationException

      Description copied from interface: `DataTable`
      Executes validators of a specific record to make sure its data is valid. Throws an error if validation fails.
      Specified by:
        `validateRecord` in interface `DataTable`
      Throws:
        `ValidationException`

    - #### setRecord

          public DataTable setRecord(int index,
                                     DataRecord record)

      Description copied from interface: `DataTable`
      Replaces record at the specified index.
      Specified by:
        `setRecord` in interface `DataTable`

    - #### swapRecords

          public void swapRecords(int index1,
                                  int index2)

      Description copied from interface: `DataTable`
      Swaps two records. Both records must belong to this table, otherwise method will throw an `IllegalStateException`
      Specified by:
        `swapRecords` in interface `DataTable`

    - #### getRecords

          @Deprecated
          public java.util.List<DataRecord> getRecords()

      Deprecated.
      Description copied from interface: `DataTable`
      Returns list of table records.
      Specified by:
        `getRecords` in interface `DataTable`

    - #### isInvalid

          public boolean isInvalid()

      Specified by:
        `isInvalid` in interface `DataTable`

    - #### getInvalidationMessage

          public java.lang.String getInvalidationMessage()

      Specified by:
        `getInvalidationMessage` in interface `DataTable`

    - #### setInvalidationMessage

          public void setInvalidationMessage(java.lang.String invalidationMessage)

      Specified by:
        `setInvalidationMessage` in interface `DataTable`

    - #### getTimestamp

          public java.util.Date getTimestamp()

      Specified by:
        `getTimestamp` in interface `DataTable`
      Specified by:
        `getTimestamp` in interface `AttributedObject`

    - #### setTimestamp

          public void setTimestamp(java.util.Date timestamp)

      Specified by:
        `setTimestamp` in interface `DataTable`
      Specified by:
        `setTimestamp` in interface `AttributedObject`

    - #### getQuality

          public java.lang.Integer getQuality()

      Specified by:
        `getQuality` in interface `DataTable`
      Specified by:
        `getQuality` in interface `AttributedObject`

    - #### setQuality

          public void setQuality(java.lang.Integer quality)

      Specified by:
        `setQuality` in interface `DataTable`
      Specified by:
        `setQuality` in interface `AttributedObject`

    - #### getValue

          public java.lang.Object getValue()

      Specified by:
        `getValue` in interface `DataTable`
      Specified by:
        `getValue` in interface `AttributedObject`

    - #### getRecord

          public DataRecord getRecord(int number)

      Description copied from interface: `DataTable`
      Returns record with specified index.
      Specified by:
        `getRecord` in interface `DataTable`

    - #### getRecordById

          public DataRecord getRecordById(java.lang.String id)

      Specified by:
        `getRecordById` in interface `DataTable`

    - #### removeRecord

          public DataRecord removeRecord(int index)

      Description copied from interface: `DataTable`
      Removes record with specified index from the table.
      Specified by:
        `removeRecord` in interface `DataTable`

    - #### removeRecordsByIds

          public void removeRecordsByIds(java.util.Collection<java.lang.String> ids)

      Description copied from interface: `DataTable`
      Removes all records from the table which contain in ids.
      Specified by:
        `removeRecordsByIds` in interface `DataTable`

    - #### removeRecords

          public void removeRecords(DataRecord rec)

      Description copied from interface: `DataTable`
      Removes all records equal to the rec parameter from the table.
      Specified by:
        `removeRecords` in interface `DataTable`

    - #### reorderRecord

          public void reorderRecord(DataRecord record,
                                    int index)

      Description copied from interface: `DataTable`
      Moves specified record to position specified by `index` argument. `record`must belong to this table, otherwise method will throw an `IllegalStateException```
      Specified by:
        `reorderRecord` in interface `DataTable`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Specified by:
        `equals` in interface `DataTable`
      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `DataTable`
      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### getEncodedData

          public java.lang.String getEncodedData(ClassicEncodingSettings settings)

      Specified by:
        `getEncodedData` in interface `DataTable`

    - #### getEncodedData

          public java.lang.StringBuilder getEncodedData(java.lang.StringBuilder finalSB,
                                                        ClassicEncodingSettings settings,
                                                        java.lang.Boolean isTransferEncode,
                                                        java.lang.Integer encodeLevel)

      Specified by:
        `getEncodedData` in interface `DataTable`

    - #### encode

          public java.lang.String encode()

      Specified by:
        `encode` in interface `DataTable`

    - #### encode

          public java.lang.String encode(boolean useVisibleSeparators)

      Specified by:
        `encode` in interface `DataTable`

    - #### encode

          public java.lang.String encode(ClassicEncodingSettings settings)

      Specified by:
        `encode` in interface `DataTable`

    - #### encode

          public java.lang.StringBuilder encode(java.lang.StringBuilder finalSB,
                                                ClassicEncodingSettings settings,
                                                java.lang.Boolean isTransferEncode,
                                                java.lang.Integer encodeLevel)

      Specified by:
        `encode` in interface `DataTable`
      Specified by:
        `encode` in interface `StringEncodable`

    - #### toString

          public java.lang.String toString()

      Specified by:
        `toString` in interface `DataTable`
      Overrides:
        `toString` in class `java.lang.Object`

    - #### getDescription

          public java.lang.String getDescription()

      Description copied from interface: `DataTable`
      Returns human-readable description of the table.
      Specified by:
        `getDescription` in interface `DataTable`

    - #### toDefaultString

          public java.lang.String toDefaultString()

      Specified by:
        `toDefaultString` in interface `DataTable`

    - #### fixRecords

          public void fixRecords()

      Specified by:
        `fixRecords` in interface `DataTable`

    - #### dataAsString

          public java.lang.String dataAsString()

      Specified by:
        `dataAsString` in interface `DataTable`

    - #### dataAsString

          public java.lang.String dataAsString(boolean showFieldNames,
                                               boolean showHiddenFields)

      Specified by:
        `dataAsString` in interface `DataTable`

    - #### dataAsString

          public java.lang.String dataAsString(boolean showFieldNames,
                                               boolean showHiddenFields,
                                               boolean showPasswords)

      Specified by:
        `dataAsString` in interface `DataTable`

    - #### isOneCellTable

          public boolean isOneCellTable()

      Description copied from interface: `DataTable`
      Returns true if table has exactly one record and one field.
      Specified by:
        `isOneCellTable` in interface `DataTable`

    - #### conform

          public boolean conform(TableFormat rf)

      Specified by:
        `conform` in interface `DataTable`

    - #### conformMessage

          public java.lang.String conformMessage(TableFormat rf)

      Specified by:
        `conformMessage` in interface `DataTable`

    - #### selectAll

          public java.util.List<DataRecord> selectAll(DataTableQuery query)

      Specified by:
        `selectAll` in interface `DataTable`

    - #### select

          public DataRecord select(DataTableQuery query)

      Specified by:
        `select` in interface `DataTable`

    - #### select

          public DataRecord select(java.lang.String field,
                                   java.lang.Object value)

      Specified by:
        `select` in interface `DataTable`

    - #### findIndex

          public java.lang.Integer findIndex(DataTableQuery query)

      Specified by:
        `findIndex` in interface `DataTable`

    - #### findIndex

          public java.lang.Integer findIndex(java.lang.String field,
                                             java.lang.Object value)

      Specified by:
        `findIndex` in interface `DataTable`

    - #### findIndex

          public java.lang.Integer findIndex(DataRecord record)

      Description copied from interface: `DataTable`
      Returns the index of the first occurrence of `record` in this Data Table, or null if this Data Table does not contain the specified record.
      Specified by:
        `findIndex` in interface `DataTable`

    - #### sort

          public void sort(java.lang.String field,
                           boolean ascending)

      Specified by:
        `sort` in interface `DataTable`

    - #### sort

          public void sort(DataTableSorter sorter)

      Specified by:
        `sort` in interface `DataTable`

    - #### sort

          public void sort(java.util.Comparator<DataRecord> comparator)

      Specified by:
        `sort` in interface `DataTable`

    - #### rec

          public DataRecord rec()

      Description copied from interface: `DataTable`
      Returns first record of the table.
      Specified by:
        `rec` in interface `DataTable`

    - #### get

          public java.lang.Object get()

      Description copied from interface: `DataTable`
      Returns value of first field in first record of the table.
      Specified by:
        `get` in interface `DataTable`

    - #### splitFormat

          public void splitFormat()

      Specified by:
        `splitFormat` in interface `DataTable`

    - #### joinFormats

          public void joinFormats()

      Specified by:
        `joinFormats` in interface `DataTable`

    - #### iterator

          public java.util.Iterator<DataRecord> iterator()

      Specified by:
        `iterator` in interface `DataTable`
      Specified by:
        `iterator` in interface `java.lang.Iterable<DataRecord>`

    - #### iterator

          public java.util.Iterator<DataRecord> iterator(int index)

      Specified by:
        `iterator` in interface `DataTable`

    - #### clone

          public DataTable clone()

      Specified by:
        `clone` in interface `DataTable`
      Overrides:
        `clone` in class `java.lang.Object`

    - #### compareTo

          public int compareTo(DataTable other)

      Specified by:
        `compareTo` in interface `DataTable`

    - #### append

          public void append(DataTable src)

      Specified by:
        `append` in interface `DataTable`

    - #### makeImmutable

          public DataTable makeImmutable()

      Specified by:
        `makeImmutable` in interface `DataTable`

    - #### cloneIfImmutable

          public DataTable cloneIfImmutable()

      Specified by:
        `cloneIfImmutable` in interface `DataTable`

    - #### isImmutable

          public boolean isImmutable()

      Specified by:
        `isImmutable` in interface `DataTable`

    - #### isSimple

          public boolean isSimple()

      Specified by:
        `isSimple` in interface `DataTable`

    - #### close

          public void close()

      Specified by:
        `close` in interface `DataTable`

    - #### stream

          public java.util.stream.Stream<DataRecord> stream()

      Specified by:
        `stream` in interface `DataTable`

    - #### forEach

          public void forEach(java.util.function.Consumer<? super DataRecord> action)

      Specified by:
        `forEach` in interface `java.lang.Iterable<DataRecord>`

    - #### spliterator

          public java.util.Spliterator<DataRecord> spliterator()

      Specified by:
        `spliterator` in interface `java.lang.Iterable<DataRecord>`

    - #### asMap

          public java.util.Map<java.lang.String,DataRecord> asMap(java.lang.String keyField)

      Represent the table as the `ImmutableMap`, using on of the fields as a key, and `DataRecord` as the value
      Parameters:
        `keyField` - - field of the datatable which will be the key of the `ImmutableMap`
      Returns:

    - #### removeRecordsByKey

          public DataRecord removeRecordsByKey(java.lang.String keyField,
                                               java.lang.String value)

      Removes the records for the specific `value` if `keyField` from this table if present.
      Parameters:
        `keyField` - - field whose mapping is to be removed from the table
      Returns:
        the record associated with `keyField`, or `null` if there was no mapping for `keyField` and `value`.

    - #### processDataTableRecursively

          public void processDataTableRecursively(TransformableDataTable.Processor processor)