1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Warnings.

This commit is contained in:
Cedric Beust 2017-05-05 12:47:29 -07:00
parent 2227783905
commit 91bb1b955c

View file

@ -6,6 +6,9 @@ import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
import java.util.* import java.util.*
/**
* Encapsulate read access to local.properties.
*/
@Singleton @Singleton
class LocalProperties { class LocalProperties {
val localProperties: Properties by lazy { val localProperties: Properties by lazy {
@ -22,11 +25,11 @@ class LocalProperties {
result result
} }
fun getNoThrows(name: String, docUrl: String? = null) = localProperties.getProperty(name) fun getNoThrows(name: String, docUrl: String? = null): String? = localProperties.getProperty(name, docUrl)
fun get(name: String, docUrl: String? = null) : String { fun get(name: String, docUrl: String? = null) : String {
val result = getNoThrows(name, docUrl) val result = getNoThrows(name, docUrl)
?: throw KobaltException("Couldn't find $name in local.properties", docUrl = docUrl) ?: throw KobaltException("Couldn't find $name in local.properties", docUrl = docUrl)
return result as String return result
} }
} }