From 5864cbcbfe2eb8c36ca05c3a39c7e5916aeecaec Mon Sep 17 00:00:00 2001 From: Dante Niewenhuis Date: Tue, 5 Mar 2024 13:23:57 +0100 Subject: Updated package versions, updated web server tests. (#207) * Updated all package versions including kotlin. Updated all web-server tests to run. * Changed the java version of the tests. OpenDC now only supports java 19. * small update * test update * new update * updated docker version to 19 * updated docker version to 19 --- .../main/kotlin/org/opendc/trace/TableColumn.kt | 2 +- .../main/kotlin/org/opendc/trace/TableReader.kt | 33 ++++-- .../main/kotlin/org/opendc/trace/TableWriter.kt | 120 ++++++++++++++++----- .../src/main/kotlin/org/opendc/trace/Trace.kt | 20 +++- .../org/opendc/trace/conv/ResourceColumns.kt | 14 +-- .../org/opendc/trace/conv/ResourceStateColumns.kt | 24 ++--- .../kotlin/org/opendc/trace/spi/TraceFormat.kt | 16 ++- .../org/opendc/trace/util/CompositeTableReader.kt | 16 ++- .../org/opendc/trace/util/TableColumnConversion.kt | 16 ++- 9 files changed, 197 insertions(+), 64 deletions(-) (limited to 'opendc-trace/opendc-trace-api/src/main/kotlin/org') diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableColumn.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableColumn.kt index 0f75d890..4e82e48a 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableColumn.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableColumn.kt @@ -32,5 +32,5 @@ package org.opendc.trace public data class TableColumn( public val name: String, public val type: TableColumnType, - public val isNullable: Boolean = false + public val isNullable: Boolean = false, ) diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableReader.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableReader.kt index 42b1c690..95a58935 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableReader.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableReader.kt @@ -143,7 +143,10 @@ public interface TableReader : AutoCloseable { * @throws IllegalArgumentException if the column index is not valid for this reader or this type. * @return The value of the column as `List` or `null` if the column is null. */ - public fun getList(index: Int, elementType: Class): List? + public fun getList( + index: Int, + elementType: Class, + ): List? /** * Obtain the value of the column with the specified [index] as [Set]. @@ -153,7 +156,10 @@ public interface TableReader : AutoCloseable { * @throws IllegalArgumentException if the column index is not valid for this reader or this type. * @return The value of the column as `Set` or `null` if the column is null. */ - public fun getSet(index: Int, elementType: Class): Set? + public fun getSet( + index: Int, + elementType: Class, + ): Set? /** * Obtain the value of the column with the specified [index] as [Set]. @@ -164,7 +170,11 @@ public interface TableReader : AutoCloseable { * @throws IllegalArgumentException if the column index is not valid for this reader or this type. * @return The value of the column as `Map` or `null` if the column is null. */ - public fun getMap(index: Int, keyType: Class, valueType: Class): Map? + public fun getMap( + index: Int, + keyType: Class, + valueType: Class, + ): Map? /** * Determine whether a column named [name] has a `null` value for the current row. @@ -264,7 +274,10 @@ public interface TableReader : AutoCloseable { * @throws IllegalArgumentException if the column index is not valid for this reader or this type. * @return The value of the column as `List` or `null` if the column is null. */ - public fun getList(name: String, elementType: Class): List? = getList(resolve(name), elementType) + public fun getList( + name: String, + elementType: Class, + ): List? = getList(resolve(name), elementType) /** * Obtain the value of the column named [name] as [Set]. @@ -274,7 +287,10 @@ public interface TableReader : AutoCloseable { * @throws IllegalArgumentException if the column index is not valid for this reader or this type. * @return The value of the column as `Set` or `null` if the column is null. */ - public fun getSet(name: String, elementType: Class): Set? = getSet(resolve(name), elementType) + public fun getSet( + name: String, + elementType: Class, + ): Set? = getSet(resolve(name), elementType) /** * Obtain the value of the column named [name] as [Set]. @@ -285,8 +301,11 @@ public interface TableReader : AutoCloseable { * @throws IllegalArgumentException if the column index is not valid for this reader or this type. * @return The value of the column as `Map` or `null` if the column is null. */ - public fun getMap(name: String, keyType: Class, valueType: Class): Map? = - getMap(resolve(name), keyType, valueType) + public fun getMap( + name: String, + keyType: Class, + valueType: Class, + ): Map? = getMap(resolve(name), keyType, valueType) /** * Closes the reader so that no further iteration or data access can be made. diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableWriter.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableWriter.kt index 3b02794d..133bd01c 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableWriter.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableWriter.kt @@ -55,7 +55,10 @@ public interface TableWriter : AutoCloseable { * @param value The boolean value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setBoolean(index: Int, value: Boolean) + public fun setBoolean( + index: Int, + value: Boolean, + ) /** * Set the column with index [index] to integer [value]. @@ -64,7 +67,10 @@ public interface TableWriter : AutoCloseable { * @param value The integer value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setInt(index: Int, value: Int) + public fun setInt( + index: Int, + value: Int, + ) /** * Set the column with index [index] to long [value]. @@ -73,7 +79,10 @@ public interface TableWriter : AutoCloseable { * @param value The long value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setLong(index: Int, value: Long) + public fun setLong( + index: Int, + value: Long, + ) /** * Set the column with index [index] to float [value]. @@ -82,7 +91,10 @@ public interface TableWriter : AutoCloseable { * @param value The float value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setFloat(index: Int, value: Float) + public fun setFloat( + index: Int, + value: Float, + ) /** * Set the column with index [index] to double [value]. @@ -91,7 +103,10 @@ public interface TableWriter : AutoCloseable { * @param value The double value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setDouble(index: Int, value: Double) + public fun setDouble( + index: Int, + value: Double, + ) /** * Set the column with index [index] to [String] [value]. @@ -100,7 +115,10 @@ public interface TableWriter : AutoCloseable { * @param value The [String] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setString(index: Int, value: String) + public fun setString( + index: Int, + value: String, + ) /** * Set the column with index [index] to [UUID] [value]. @@ -109,7 +127,10 @@ public interface TableWriter : AutoCloseable { * @param value The [UUID] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setUUID(index: Int, value: UUID) + public fun setUUID( + index: Int, + value: UUID, + ) /** * Set the column with index [index] to [Instant] [value]. @@ -118,7 +139,10 @@ public interface TableWriter : AutoCloseable { * @param value The [Instant] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setInstant(index: Int, value: Instant) + public fun setInstant( + index: Int, + value: Instant, + ) /** * Set the column with index [index] to [Duration] [value]. @@ -127,7 +151,10 @@ public interface TableWriter : AutoCloseable { * @param value The [Duration] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setDuration(index: Int, value: Duration) + public fun setDuration( + index: Int, + value: Duration, + ) /** * Set the column with index [index] to [List] [value]. @@ -136,7 +163,10 @@ public interface TableWriter : AutoCloseable { * @param value The [Map] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setList(index: Int, value: List) + public fun setList( + index: Int, + value: List, + ) /** * Set the column with index [index] to [Set] [value]. @@ -145,7 +175,10 @@ public interface TableWriter : AutoCloseable { * @param value The [Set] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setSet(index: Int, value: Set) + public fun setSet( + index: Int, + value: Set, + ) /** * Set the column with index [index] to [Map] [value]. @@ -154,7 +187,10 @@ public interface TableWriter : AutoCloseable { * @param value The [Map] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setMap(index: Int, value: Map) + public fun setMap( + index: Int, + value: Map, + ) /** * Set the column named [name] to boolean [value]. @@ -163,7 +199,10 @@ public interface TableWriter : AutoCloseable { * @param value The boolean value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setBoolean(name: String, value: Boolean): Unit = setBoolean(resolve(name), value) + public fun setBoolean( + name: String, + value: Boolean, + ): Unit = setBoolean(resolve(name), value) /** * Set the column named [name] to integer [value]. @@ -172,7 +211,10 @@ public interface TableWriter : AutoCloseable { * @param value The integer value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setInt(name: String, value: Int): Unit = setInt(resolve(name), value) + public fun setInt( + name: String, + value: Int, + ): Unit = setInt(resolve(name), value) /** * Set the column named [name] to long [value]. @@ -181,7 +223,10 @@ public interface TableWriter : AutoCloseable { * @param value The long value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setLong(name: String, value: Long): Unit = setLong(resolve(name), value) + public fun setLong( + name: String, + value: Long, + ): Unit = setLong(resolve(name), value) /** * Set the column named [name] to float [value]. @@ -190,7 +235,10 @@ public interface TableWriter : AutoCloseable { * @param value The float value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setFloat(name: String, value: Float): Unit = setFloat(resolve(name), value) + public fun setFloat( + name: String, + value: Float, + ): Unit = setFloat(resolve(name), value) /** * Set the column named [name] to double [value]. @@ -199,7 +247,10 @@ public interface TableWriter : AutoCloseable { * @param value The double value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setDouble(name: String, value: Double): Unit = setDouble(resolve(name), value) + public fun setDouble( + name: String, + value: Double, + ): Unit = setDouble(resolve(name), value) /** * Set the column named [name] to [String] [value]. @@ -208,7 +259,10 @@ public interface TableWriter : AutoCloseable { * @param value The [String] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setString(name: String, value: String): Unit = setString(resolve(name), value) + public fun setString( + name: String, + value: String, + ): Unit = setString(resolve(name), value) /** * Set the column named [name] to [UUID] [value]. @@ -217,7 +271,10 @@ public interface TableWriter : AutoCloseable { * @param value The [UUID] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setUUID(name: String, value: UUID): Unit = setUUID(resolve(name), value) + public fun setUUID( + name: String, + value: UUID, + ): Unit = setUUID(resolve(name), value) /** * Set the column named [name] to [Instant] [value]. @@ -226,7 +283,10 @@ public interface TableWriter : AutoCloseable { * @param value The [Instant] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setInstant(name: String, value: Instant): Unit = setInstant(resolve(name), value) + public fun setInstant( + name: String, + value: Instant, + ): Unit = setInstant(resolve(name), value) /** * Set the column named [name] to [Duration] [value]. @@ -235,7 +295,10 @@ public interface TableWriter : AutoCloseable { * @param value The [Duration] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setDuration(name: String, value: Duration): Unit = setDuration(resolve(name), value) + public fun setDuration( + name: String, + value: Duration, + ): Unit = setDuration(resolve(name), value) /** * Set the column named [name] to [List] [value]. @@ -244,7 +307,10 @@ public interface TableWriter : AutoCloseable { * @param value The [List] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setList(name: String, value: List): Unit = setList(resolve(name), value) + public fun setList( + name: String, + value: List, + ): Unit = setList(resolve(name), value) /** * Set the column named [name] to [Set] [value]. @@ -253,7 +319,10 @@ public interface TableWriter : AutoCloseable { * @param value The [Set] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setSet(name: String, value: Set): Unit = setSet(resolve(name), value) + public fun setSet( + name: String, + value: Set, + ): Unit = setSet(resolve(name), value) /** * Set the column named [name] to [Map] [value]. @@ -262,7 +331,10 @@ public interface TableWriter : AutoCloseable { * @param value The [Map] value to set the column to. * @throws IllegalArgumentException if the column is not valid for this method. */ - public fun setMap(name: String, value: Map): Unit = setMap(resolve(name), value) + public fun setMap( + name: String, + value: Map, + ): Unit = setMap(resolve(name), value) /** * Flush any buffered content to the underlying target. diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/Trace.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/Trace.kt index 64e8f272..a1059e9e 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/Trace.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/Trace.kt @@ -55,7 +55,10 @@ public interface Trace { * @throws IllegalArgumentException if [format] is not supported. */ @JvmStatic - public fun open(path: File, format: String): Trace = open(path.toPath(), format) + public fun open( + path: File, + format: String, + ): Trace = open(path.toPath(), format) /** * Open a [Trace] at the specified [path] in the given [format]. @@ -65,7 +68,10 @@ public interface Trace { * @throws IllegalArgumentException if [format] is not supported. */ @JvmStatic - public fun open(path: Path, format: String): Trace { + public fun open( + path: Path, + format: String, + ): Trace { val provider = requireNotNull(TraceFormat.byName(format)) { "Unknown format $format" } return TraceImpl(provider, path) } @@ -77,7 +83,10 @@ public interface Trace { * @param format The format of the trace to create. */ @JvmStatic - public fun create(path: File, format: String): Trace = create(path.toPath(), format) + public fun create( + path: File, + format: String, + ): Trace = create(path.toPath(), format) /** * Create a [Trace] at the specified [path] in the given [format]. @@ -86,7 +95,10 @@ public interface Trace { * @param format The format of the trace to create. */ @JvmStatic - public fun create(path: Path, format: String): Trace { + public fun create( + path: Path, + format: String, + ): Trace { val provider = requireNotNull(TraceFormat.byName(format)) { "Unknown format $format" } provider.create(path) return TraceImpl(provider, path) diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceColumns.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceColumns.kt index 89f8dbc4..046dd13d 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceColumns.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceColumns.kt @@ -28,40 +28,40 @@ package org.opendc.trace.conv * Identifier of the resource. */ @JvmField -public val RESOURCE_ID: String = "id" +public val resourceID: String = "id" /** * The cluster to which the resource belongs. */ @JvmField -public val RESOURCE_CLUSTER_ID: String = "cluster_id" +public val resourceClusterID: String = "cluster_id" /** * Start time for the resource. */ @JvmField -public val RESOURCE_START_TIME: String = "start_time" +public val resourceStartTime: String = "start_time" /** * End time for the resource. */ @JvmField -public val RESOURCE_STOP_TIME: String = "stop_time" +public val resourceStopTime: String = "stop_time" /** * Number of CPUs for the resource. */ @JvmField -public val RESOURCE_CPU_COUNT: String = "cpu_count" +public val resourceCpuCount: String = "cpu_count" /** * Total CPU capacity of the resource in MHz. */ @JvmField -public val RESOURCE_CPU_CAPACITY: String = "cpu_capacity" +public val resourceCpuCapacity: String = "cpu_capacity" /** * Memory capacity for the resource in KB. */ @JvmField -public val RESOURCE_MEM_CAPACITY: String = "mem_capacity" +public val resourceMemCapacity: String = "mem_capacity" diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceStateColumns.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceStateColumns.kt index 5187d501..eede6bd6 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceStateColumns.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceStateColumns.kt @@ -28,70 +28,70 @@ package org.opendc.trace.conv * The timestamp at which the state was recorded. */ @JvmField -public val RESOURCE_STATE_TIMESTAMP: String = "timestamp" +public val resourceStateTimestamp: String = "timestamp" /** * Duration for the state. */ @JvmField -public val RESOURCE_STATE_DURATION: String = "duration" +public val resourceStateDuration: String = "duration" /** * A flag to indicate that the resource is powered on. */ @JvmField -public val RESOURCE_STATE_POWERED_ON: String = "powered_on" +public val resourceStatePoweredOn: String = "powered_on" /** * Total CPU usage of the resource in MHz. */ @JvmField -public val RESOURCE_STATE_CPU_USAGE: String = "cpu_usage" +public val resourceStateCpuUsage: String = "cpu_usage" /** * Total CPU usage of the resource in percentage. */ @JvmField -public val RESOURCE_STATE_CPU_USAGE_PCT: String = "cpu_usage_pct" +public val resourceStateCpuUsagePct: String = "cpu_usage_pct" /** * Total CPU demand of the resource in MHz. */ @JvmField -public val RESOURCE_STATE_CPU_DEMAND: String = "cpu_demand" +public val resourceStateCpuDemand: String = "cpu_demand" /** * CPU ready percentage. */ @JvmField -public val RESOURCE_STATE_CPU_READY_PCT: String = "cpu_ready_pct" +public val resourceStateCpuReadyPct: String = "cpu_ready_pct" /** * Memory usage of the resource in KB. */ @JvmField -public val RESOURCE_STATE_MEM_USAGE: String = "mem_usage" +public val resourceStateMemUsage: String = "mem_usage" /** * Disk read throughput of the resource in KB/s. */ @JvmField -public val RESOURCE_STATE_DISK_READ: String = "disk_read" +public val resourceStateDiskRead: String = "disk_read" /** * Disk write throughput of the resource in KB/s. */ @JvmField -public val RESOURCE_STATE_DISK_WRITE: String = "disk_write" +public val resourceStateDiskWrite: String = "disk_write" /** * Network receive throughput of the resource in KB/s. */ @JvmField -public val RESOURCE_STATE_NET_RX: String = "net_rx" +public val resourceStateNetRx: String = "net_rx" /** * Network transmit throughput of the resource in KB/s. */ @JvmField -public val RESOURCE_STATE_NET_TX: String = "net_tx" +public val resourceStateNetTx: String = "net_tx" diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt index 46ef051d..83537822 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt @@ -61,7 +61,10 @@ public interface TraceFormat { * @throws IllegalArgumentException If [table] does not exist. * @return The [TableDetails] for the specified [table]. */ - public fun getDetails(path: Path, table: String): TableDetails + public fun getDetails( + path: Path, + table: String, + ): TableDetails /** * Open a [TableReader] for the specified [table]. @@ -72,7 +75,11 @@ public interface TraceFormat { * @throws IllegalArgumentException If [table] does not exist. * @return A [TableReader] instance for the table. */ - public fun newReader(path: Path, table: String, projection: List?): TableReader + public fun newReader( + path: Path, + table: String, + projection: List?, + ): TableReader /** * Open a [TableWriter] for the specified [table]. @@ -83,7 +90,10 @@ public interface TraceFormat { * @throws UnsupportedOperationException If the format does not support writing. * @return A [TableWriter] instance for the table. */ - public fun newWriter(path: Path, table: String): TableWriter + public fun newWriter( + path: Path, + table: String, + ): TableWriter /** * A helper object for resolving providers. diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/CompositeTableReader.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/CompositeTableReader.kt index 2fe820c4..4b9a0d95 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/CompositeTableReader.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/CompositeTableReader.kt @@ -122,17 +122,27 @@ public abstract class CompositeTableReader : TableReader { return delegate.getDuration(index) } - override fun getList(index: Int, elementType: Class): List? { + override fun getList( + index: Int, + elementType: Class, + ): List? { val delegate = checkNotNull(delegate) { "Invalid reader state" } return delegate.getList(index, elementType) } - override fun getSet(index: Int, elementType: Class): Set? { + override fun getSet( + index: Int, + elementType: Class, + ): Set? { val delegate = checkNotNull(delegate) { "Invalid reader state" } return delegate.getSet(index, elementType) } - override fun getMap(index: Int, keyType: Class, valueType: Class): Map? { + override fun getMap( + index: Int, + keyType: Class, + valueType: Class, + ): Map? { val delegate = checkNotNull(delegate) { "Invalid reader state" } return delegate.getMap(index, keyType, valueType) } diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/TableColumnConversion.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/TableColumnConversion.kt index 26739e34..fda2bc54 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/TableColumnConversion.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/TableColumnConversion.kt @@ -32,7 +32,10 @@ import java.util.UUID /** * Helper method to convert a [List] into a [List] with elements of [targetElementType]. */ -public fun TableColumnType.List.convertTo(value: List<*>?, targetElementType: Class): List? { +public fun TableColumnType.List.convertTo( + value: List<*>?, + targetElementType: Class, +): List? { require(elementType.isCompatible(targetElementType)) { "Target element type is not compatible with $elementType" } @Suppress("UNCHECKED_CAST") return value as List? @@ -41,7 +44,10 @@ public fun TableColumnType.List.convertTo(value: List<*>?, targetElementType /** * Helper method to convert a [Set] into a [Set] with elements of [targetElementType]. */ -public fun TableColumnType.Set.convertTo(value: Set<*>?, targetElementType: Class): Set? { +public fun TableColumnType.Set.convertTo( + value: Set<*>?, + targetElementType: Class, +): Set? { require(elementType.isCompatible(targetElementType)) { "Target element type is not compatible with $elementType" } @Suppress("UNCHECKED_CAST") return value as Set? @@ -50,7 +56,11 @@ public fun TableColumnType.Set.convertTo(value: Set<*>?, targetElementType: /** * Helper method to convert a [Map] into a [Map] with [targetKeyType] keys and [targetValueType] values. */ -public fun TableColumnType.Map.convertTo(value: Map<*, *>?, targetKeyType: Class, targetValueType: Class): Map? { +public fun TableColumnType.Map.convertTo( + value: Map<*, *>?, + targetKeyType: Class, + targetValueType: Class, +): Map? { require(keyType.isCompatible(targetKeyType)) { "Target key type $targetKeyType is not compatible with $keyType" } require(valueType.isCompatible(targetValueType)) { "Target value type $targetValueType is not compatible with $valueType" } @Suppress("UNCHECKED_CAST") -- cgit v1.2.3