TabularData

abstract class TabularData(tableName: String)

TabularData represents a base class for constructing data classes that hold tabular data. Only base types can be represented. Numeric columns can be represented by (Double, Int, Long, Short, Byte, Float, and Boolean). Boolean is considered numeric via conversion with 1 true and 0 false. Non-numeric fields are represented by String. Complex data types are not represented.

Subclasses of this base class can be used represent database tables that represent data views or results.

A usage of TabularData is to hold data extracted from a database table, view, or result set.

Example usage:

data class Person(var name:String, var age:Int): TabularData("Persons")
db.selectDbDataInto(::Person)

Assume that db holds an instance to a database that has a table called, Persons, with the fields name and age as the sole columns, in that order. The data will be extracted from the database table and instances of the data class created and filled with the data from the table. As long as the data class properties match in order and with compatible types with the fields/columns of the database, then the instances will be created and filled.

If used within the context of a database, the tableName should be a valid table name or view name within the database. Any white space in the table name is replaced with an underscore character. For example, "My Table Name" becomes "My_Table_Name"

Inheritors

Constructors

Link copied to clipboard
constructor(tableName: String)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The number of columns of data. The number of public mutable properties including any auto-increment field

Link copied to clipboard

The optional name of the schema holding the table for the related data. If supplied it cannot be empty/blank and any white space will be replaced with underscore characters.

Link copied to clipboard

White space in the string is replaced by an underscore

Functions

Link copied to clipboard

Extracts the value of the public mutable properties of a data class If the object is not an instance of a data class, then the returned map will be empty. The map contains the pairs of (name, value) where name is the name of the public, mutable property and value is the current value of the property

Link copied to clipboard

Extracts the property of the public mutable properties of a data class Classifies each property whether it can be converted to a numeric value via isNumericConvertable(). All non-numeric mutable properties are considered TEXT; otherwise, they are considered NUMERIC.

Link copied to clipboard

Extracts the property of the public mutable properties of a data class If the object is not an instance of a data class, then the returned map will be empty. The map contains the pairs of (name, property) where name is the name of the public property and property is the reflection property

Link copied to clipboard

Extracts the names of the public, mutable properties of a data class in the order in which they are declared in the primary constructor.

Link copied to clipboard

Extracts the values of the public, mutable properties of a data class in the order in which they are declared in the primary constructor.

Link copied to clipboard
fun setPropertyValues(values: List<Any?>)

Sets the values of the public mutable properties of a data class to the values supplied. If the object is not an instance of a data class then nothing happens. The size of the supplied list must be the same as the number of the mutable properties and the type of each element in the supplied list must match the type of the mutable property

Sets the values of the public mutable properties of a data class to the values supplied. If the object is not an instance of a data class then nothing happens. The row from a TabularFile must map to the property values