ai.digital.integration.server.common.util.PropertyUtil.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of integration-server-gradle-plugin Show documentation
Show all versions of integration-server-gradle-plugin Show documentation
The easy way to get custom setup for Deploy up and running
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()
}
}
}