1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28:12 -07:00
kobalt/src/main/kotlin/com/beust/kobalt/api/PluginProperties.kt
2015-11-03 10:56:35 -08:00

23 lines
733 B
Kotlin

package com.beust.kobalt.api
import com.google.inject.Inject
import java.util.*
/**
* Plugins can publish to and read from this object in order to exchange information. Keys stored in
* these maps should be annotated with @ExportedProperty.
*/
class PluginProperties @Inject constructor() {
private val pluginProperties = hashMapOf<String, HashMap<String, Any>>()
fun put(pluginName: String, key: String, value: Any) {
var map = pluginProperties[pluginName]
if (map == null) {
map = hashMapOf<String, Any>()
pluginProperties.put(pluginName, map)
}
map.put(key, value)
}
fun get(pluginName: String, key: String) = pluginProperties[pluginName]?.get(key)
}