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

cloud.hedou.abp.identity.AbpRoleLevelDeserializer.kt Maven / Gradle / Ivy

Go to download

When the functions of ABP cannot meet service requirements, the Spring Boot framework can be used to expand its own services to make use of abundant Java frameworks on the market.

There is a newer version: 1.0.1
Show newest version
package cloud.hedou.abp.identity

import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.deser.std.StdDeserializer
import com.fasterxml.jackson.databind.node.ObjectNode

class AbpRoleLevelDeserializer : StdDeserializer(Int::class.javaPrimitiveType) {

    override fun deserialize(p: JsonParser, ctxt: DeserializationContext): Int {
        val objectNode = p.readValueAsTree()
        val jsonNode = objectNode.get("Level")
        if(jsonNode.isInt) {
            return jsonNode.intValue()
        } else if(jsonNode.isTextual) {
            return jsonNode.textValue().toInt()
        }
        return 0
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy