com.neko233.config233.reader.convert.impl.IntObjConvertTextValueStrategy.kt Maven / Gradle / Ivy
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
}
}
}