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

io.javalin.config.ValidationConfig.kt Maven / Gradle / Ivy

There is a newer version: 6.3.0
Show newest version
package io.javalin.config

class ValidationConfig() {

    internal val converters = mutableMapOf, (String) -> Any?>(
        java.lang.Boolean::class.java to { it.toBoolean() },
        java.lang.Double::class.java to { it.toDouble() },
        java.lang.Float::class.java to { it.toFloat() },
        java.lang.Integer::class.java to { it.toInt() },
        java.lang.Long::class.java to { it.toLong() },
        java.lang.String::class.java to { it },
        Boolean::class.java to { it.toBoolean() },
        Double::class.java to { it.toDouble() },
        Float::class.java to { it.toFloat() },
        Int::class.java to { it.toInt() },
        Long::class.java to { it.toLong() },
        String::class.java to { it }
    )

    fun register(clazz: Class<*>, converter: (String) -> Any?) {
        converters[clazz] = converter
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy