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