All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uy.kohesive.kovert.core.Controllers.kt Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show newest version
package uy.kohesive.kovert.core

import uy.klutter.reflect.erasedType
import uy.klutter.reflect.full.isAssignableFrom
import uy.klutter.reflect.isAssignableFrom
import java.math.BigDecimal
import java.util.*
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.reflect.jvm.javaType


public fun isSimpleDataType(type: Class<*>) = knownSimpleTypes.any { type.isAssignableFrom(it) } || simpleTypeNames.contains(type.getName())
public fun  isSimpleDataType(type: KClass) = knownSimpleTypes.any { type.isAssignableFrom(it) } || simpleTypeNames.contains(type.qualifiedName ?: "")
public fun isSimpleDataType(type: KType) = knownSimpleTypes.any { type.isAssignableFrom(it) } || simpleTypeNames.contains(type.javaType.erasedType().name)

@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
public val knownSimpleTypes = linkedListOf>(Boolean::class, Number::class, String::class,
        Date::class,
        java.lang.Byte::class, java.lang.Short::class, java.lang.Integer::class, java.lang.Long::class,
        java.lang.Float::class, java.lang.Double::class,  BigDecimal::class)

internal val simpleTypeNames = setOf("byte", "char", "short", "int", "long", "float", "double", "string", "boolean")




© 2015 - 2024 Weber Informatics LLC | Privacy Policy