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

kotlinbase.lorenwang.tools.extend.KttlwExtendMap.kt Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha05
Show newest version
package kotlinbase.lorenwang.tools.extend

import javabase.lorenwang.dataparse.JdplwJsonUtils
import javabase.lorenwang.tools.common.JtlwCheckVariateUtils

/**
 * 功能作用:Map函数扩展
 * 创建时间:2019-11-14 下午 23:17:43
 * 创建人:王亮(Loren wang)
 * 思路:
 * 方法:
 * 注意:
 * 修改人:
 * 修改时间:
 * 备注:
 */

/**
 * 获取实例的json数据
 */
fun  Map.kttlwParseJsonData(cls: Class): R? {
    return try {
        JdplwJsonUtils.fromJson(this, cls)
    } catch (e: Exception) {
        null
    }
}

/**
 * 获取非空数据
 */
fun  Map?.kttlwGetNotEmptyData(defaultData: Map = mapOf()): Map {
    return if (this.isNullOrEmpty()) {
        defaultData
    } else {
        this
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy