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

com.neko233.config233.reader.convert.impl.IntObjConvertTextValueStrategy.kt Maven / Gradle / Ivy

The newest version!
package com.neko233.config233.reader.convert.impl

import com.neko233.config233.reader.convert.JavaTypeConvertTextValueStrategy
import java.math.BigDecimal

class IntObjConvertTextValueStrategy : JavaTypeConvertTextValueStrategy {

    override fun dataType(): Class = Int::class.javaObjectType

    override fun convert(colValue: String): Int? {
        return try {
            BigDecimal(colValue).toInt()
        } catch (e: NumberFormatException) {
            null
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy