net.nemerosa.ontrack.model.support.SettingsRepositoryExtensions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-model Show documentation
Show all versions of ontrack-model Show documentation
Ontrack module: ontrack-model
package net.nemerosa.ontrack.model.support
import kotlin.reflect.KProperty0
import kotlin.reflect.KProperty1
/**
* Type safe access to settings.
*/
inline fun SettingsRepository.getString(property: KProperty1, defaultValue: String): String =
getString(T::class.java, property.name, defaultValue)
/**
* Type safe access to settings.
*/
inline fun SettingsRepository.getInt(property: KProperty1, defaultValue: Int): Int =
getInt(T::class.java, property.name, defaultValue)
/**
* Type safe access to settings.
*/
inline fun SettingsRepository.getBoolean(property: KProperty1, defaultValue: Boolean): Boolean =
getBoolean(T::class.java, property.name, defaultValue)
/**
* Type safe access to settings.
*/
inline fun SettingsRepository.getPassword(
property: KProperty1,
defaultValue: String,
noinline decryptService: (String?) -> String?
): String = getPassword(T::class.java, property.name, defaultValue, decryptService)
/**
* Type safe setter of settings
*/
inline fun SettingsRepository.setString(property: KProperty0) {
setString(T::class.java, property.name, property.get())
}
/**
* Type safe setter of settings
*/
inline fun SettingsRepository.setBoolean(property: KProperty0) {
setBoolean(T::class.java, property.name, property.get())
}
/**
* Type safe setter of settings
*/
inline fun SettingsRepository.setInt(property: KProperty0) {
setInt(T::class.java, property.name, property.get())
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy