public class TransformableDataTable extends java.lang.Object implements DataTable
| Modifier and Type | Class and Description |
|---|---|
static interface |
TransformableDataTable.Processor |
| Constructor and Description |
|---|
TransformableDataTable(DataTable origin) |
| 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.
|
public TransformableDataTable(DataTable origin)
public java.lang.Integer getRecordCount()
DataTablegetRecordCount in interface DataTablepublic int getFieldCount()
DataTablegetFieldCount in interface DataTablepublic TableFormat getFormat()
DataTablepublic DataTable setFormat(TableFormat format)
DataTablepublic FieldFormat getFormat(int field)
DataTablepublic FieldFormat getFormat(java.lang.String name)
DataTablepublic boolean applyCachedFormat(java.util.Optional<FormatCache> formatCache)
applyCachedFormat in interface DataTablepublic java.lang.Long getId()
DataTablepublic void setId(java.lang.Long id)
DataTablepublic boolean hasField(java.lang.String field)
public DataTable addRecords(java.util.List<DataRecord> records)
DataTableaddRecords in interface DataTablepublic DataTable addRecord(DataRecord record)
DataTablepublic DataRecord addRecord(java.lang.Object... fieldValues)
DataTablepublic DataTable addRecord(int index, DataRecord record)
DataTablepublic DataRecord addRecord()
DataTablepublic void validate(Context context, ContextManager contextManager, CallerController caller) throws DataTableException
DataTablevalidate in interface DataTableDataTableExceptionpublic void validateRecord(DataRecord record) throws ValidationException
DataTablevalidateRecord in interface DataTableValidationExceptionpublic DataTable setRecord(int index, DataRecord record)
DataTablepublic void swapRecords(int index1,
int index2)
DataTableIllegalStateExceptionswapRecords in interface DataTable@Deprecated public java.util.List<DataRecord> getRecords()
DataTablegetRecords in interface DataTablepublic java.lang.String getInvalidationMessage()
getInvalidationMessage in interface DataTablepublic void setInvalidationMessage(java.lang.String invalidationMessage)
setInvalidationMessage in interface DataTablepublic java.util.Date getTimestamp()
getTimestamp in interface DataTablegetTimestamp in interface AttributedObjectpublic void setTimestamp(java.util.Date timestamp)
setTimestamp in interface DataTablesetTimestamp in interface AttributedObjectpublic java.lang.Integer getQuality()
getQuality in interface DataTablegetQuality in interface AttributedObjectpublic void setQuality(java.lang.Integer quality)
setQuality in interface DataTablesetQuality in interface AttributedObjectpublic java.lang.Object getValue()
getValue in interface DataTablegetValue in interface AttributedObjectpublic DataRecord getRecord(int number)
DataTablepublic DataRecord getRecordById(java.lang.String id)
getRecordById in interface DataTablepublic DataRecord removeRecord(int index)
DataTableremoveRecord in interface DataTablepublic void removeRecordsByIds(java.util.Collection<java.lang.String> ids)
DataTableremoveRecordsByIds in interface DataTablepublic void removeRecords(DataRecord rec)
DataTableremoveRecords in interface DataTablepublic void reorderRecord(DataRecord record, int index)
DataTableindex argument.
record must belong to this table, otherwise method will throw an IllegalStateExceptionreorderRecord in interface DataTablepublic boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.String getEncodedData(ClassicEncodingSettings settings)
getEncodedData in interface DataTablepublic java.lang.StringBuilder getEncodedData(java.lang.StringBuilder finalSB,
ClassicEncodingSettings settings,
java.lang.Boolean isTransferEncode,
java.lang.Integer encodeLevel)
getEncodedData in interface DataTablepublic java.lang.String encode(boolean useVisibleSeparators)
public java.lang.String encode(ClassicEncodingSettings settings)
public java.lang.StringBuilder encode(java.lang.StringBuilder finalSB,
ClassicEncodingSettings settings,
java.lang.Boolean isTransferEncode,
java.lang.Integer encodeLevel)
encode in interface DataTableencode in interface StringEncodablepublic java.lang.String toString()
public java.lang.String getDescription()
DataTablegetDescription in interface DataTablepublic java.lang.String toDefaultString()
toDefaultString in interface DataTablepublic void fixRecords()
fixRecords in interface DataTablepublic java.lang.String dataAsString()
dataAsString in interface DataTablepublic java.lang.String dataAsString(boolean showFieldNames,
boolean showHiddenFields)
dataAsString in interface DataTablepublic java.lang.String dataAsString(boolean showFieldNames,
boolean showHiddenFields,
boolean showPasswords)
dataAsString in interface DataTablepublic boolean isOneCellTable()
DataTableisOneCellTable in interface DataTablepublic boolean conform(TableFormat rf)
public java.lang.String conformMessage(TableFormat rf)
conformMessage in interface DataTablepublic java.util.List<DataRecord> selectAll(DataTableQuery query)
public DataRecord select(DataTableQuery query)
public DataRecord select(java.lang.String field, java.lang.Object value)
public java.lang.Integer findIndex(DataTableQuery query)
public java.lang.Integer findIndex(java.lang.String field,
java.lang.Object value)
public java.lang.Integer findIndex(DataRecord record)
DataTablerecord in this Data Table, or null if this Data Table does not contain the specified record.public void sort(java.lang.String field,
boolean ascending)
public void sort(DataTableSorter sorter)
public void sort(java.util.Comparator<DataRecord> comparator)
public DataRecord rec()
DataTablepublic java.lang.Object get()
DataTablepublic void splitFormat()
splitFormat in interface DataTablepublic void joinFormats()
joinFormats in interface DataTablepublic java.util.Iterator<DataRecord> iterator()
iterator in interface DataTableiterator in interface java.lang.Iterable<DataRecord>public java.util.Iterator<DataRecord> iterator(int index)
public DataTable clone()
public DataTable makeImmutable()
makeImmutable in interface DataTablepublic DataTable cloneIfImmutable()
cloneIfImmutable in interface DataTablepublic boolean isImmutable()
isImmutable in interface DataTablepublic java.util.stream.Stream<DataRecord> stream()
public void forEach(java.util.function.Consumer<? super DataRecord> action)
forEach in interface java.lang.Iterable<DataRecord>public java.util.Spliterator<DataRecord> spliterator()
spliterator in interface java.lang.Iterable<DataRecord>public java.util.Map<java.lang.String,DataRecord> asMap(java.lang.String keyField)
ImmutableMap, using on of the fields as a key, and DataRecord as the valuekeyField - - field of the datatable which will be the key of the ImmutableMappublic DataRecord removeRecordsByKey(java.lang.String keyField, java.lang.String value)
value if keyField from this table if present.keyField - - field whose mapping is to be removed from the tablekeyField, or null if there was no mapping for
keyField and value.public void processDataTableRecursively(TransformableDataTable.Processor processor)