# NullableColumnWithTransform

open class NullableColumnWithTransform<Unwrapped, Wrapped>(delegate: IColumnType<Unwrapped & Any>, transformer: ColumnTransformer<Unwrapped, Wrapped>) : ColumnWithTransform<Unwrapped, Wrapped>

A class that handles the transformation between a source column type and a target type, but also supports transformations involving `null` values.

NullableColumnWithTransform extends ColumnType and can be used to define columns that can transform `null` to `non-null` values and vice versa.

#### Parameters

Wrapped

The type to which the column value of type Unwrapped is transformed

Unwrapped

The type of the column

delegate

The original column's IColumnType

transformer

Instance of ColumnTransformer that makes actual data transformation

## Constructors

NullableColumnWithTransform
Link copied to clipboard
constructor(delegate: IColumnType<Unwrapped & Any>, transformer: ColumnTransformer<Unwrapped, Wrapped>)

## Properties

delegate
Link copied to clipboard
val delegate: IColumnType<Unwrapped & Any>
isAutoInc
Link copied to clipboard
val IColumnType<*>.isAutoInc: Boolean

Returns `true` if this is an auto-increment column, `false` otherwise.

nullable
Link copied to clipboard
open override var nullable: Boolean

Returns `true` if the column type is nullable, `false` otherwise.

originalColumnType
Link copied to clipboard
val originalColumnType: IColumnType<Any>

Gets the original column type that this column with transformation wraps around.

transformer
Link copied to clipboard
val transformer: ColumnTransformer<Unwrapped, Wrapped>

## Functions

equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open override fun hashCode(): Int
nonNullValueAsDefaultString
Link copied to clipboard
open fun nonNullValueAsDefaultString(value: Wrapped & Any): String

Returns the String representation of the specified non-null value when value is set as the default for the column.

nonNullValueToString
Link copied to clipboard
open fun nonNullValueToString(value: Wrapped & Any): String

Returns the SQL representation of the specified non-null value, for this column type.

notNullValueToDB
Link copied to clipboard
open override fun notNullValueToDB(value: Wrapped & Any): Any

Returns an object compatible with the database, from the specified non-null value, for this column type.

parameterMarker
Link copied to clipboard
open fun parameterMarker(value: Wrapped?): String

Defines the appearance of parameter markers in prepared SQL statements.

readObject
Link copied to clipboard
open fun readObject(rs: ResultSet, index: Int): Any?

Returns the object at the specified index in the rs.

setParameter
Link copied to clipboard
open override fun setParameter(stmt: PreparedStatementApi, index: Int, value: Any?)

Sets the value at the specified index into the stmt.

sqlType
Link copied to clipboard
open override fun sqlType(): String

Returns the SQL type of this column.

toString
Link copied to clipboard
open override fun toString(): String
unwrapRecursive
Link copied to clipboard
open override fun unwrapRecursive(value: Wrapped?): Any?

Recursively unwraps the given value by applying the delegate's transformation.

validateValueBeforeUpdate
Link copied to clipboard
open fun validateValueBeforeUpdate(value: Wrapped?)

Function checks that provided value is suites the column type and throws IllegalArgumentException otherwise. value can be of any type (including Expression)

valueAsDefaultString
Link copied to clipboard
open fun valueAsDefaultString(value: Wrapped?): String

Returns the String representation of the specified value when value is set as the default for the column. If the value is `null` and the column is not nullable, an exception will be thrown. Used for metadata default value comparison.

valueFromDB
Link copied to clipboard
open override fun valueFromDB(value: Any): Wrapped?

Converts the specified value (from the database) to an object of the appropriated type, for this column type. Default implementation returns the same instance.

valueToDB
Link copied to clipboard
open override fun valueToDB(value: Wrapped?): Any?

Returns an object compatible with the database, from the specified value, for this column type.

valueToString
Link copied to clipboard
open override fun valueToString(value: Wrapped?): String

Returns the SQL representation of the specified value, for this column type. If the value is `null` and the column is not nullable, an exception will be thrown. Used when generating an SQL statement and when logging that statement.