com.neko233.config233.reader.convert.impl.IntConvertTextValueStrategy.kt Maven / Gradle / Ivy
package com.neko233.config233.reader.convert.impl
import com.neko233.config233.reader.convert.JavaTypeConvertTextValueStrategy
import java.math.BigDecimal
class IntConvertTextValueStrategy : JavaTypeConvertTextValueStrategy {
override fun dataType(): Class = Int::class.java
override fun convert(colValue: String): Int? {
return try {
BigDecimal(colValue).toInt()
} catch (e: NumberFormatException) {
null
}
}
}