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

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

There is a newer version: 0.1.8
Show newest version
package com.neko233.config233.reader.convert.impl

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

class ShortConvertTextValueStrategy : JavaTypeConvertTextValueStrategy {
    override fun dataType(): Class = Short::class.java

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy