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

ai.digital.integration.server.common.util.PropertyUtil.kt Maven / Gradle / Ivy

There is a newer version: 23.3.0-1025.941
Show newest version
package ai.digital.integration.server.common.util

import org.gradle.api.Project

class PropertyUtil {
    companion object {

        fun resolveValue(project: Project, propertyName: String, defaultValue: Any?): Any? {
            return if (project.hasProperty(propertyName)) {
                project.property(propertyName)
            } else {
                defaultValue
            }
        }

        fun resolveIntValue(project: Project, propertyName: String, defaultValue: Any?): Int? {
            val value = resolveValue(project, propertyName, defaultValue)
            return value?.toString()?.toInt()
        }

        fun resolveBooleanValue(project: Project, propertyName: String, defaultValue: Any?): Boolean {
            val value = resolveValue(project, propertyName, defaultValue)
            return value?.toString()!!.toBoolean()
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy