org.jetbrains.spek.engine.extension.ExtensionRegistryImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spek-junit-platform-engine Show documentation
Show all versions of spek-junit-platform-engine Show documentation
Spek TestEngine for the JUnit Platform
package org.jetbrains.spek.engine.extension
import org.jetbrains.spek.extension.Extension
import org.jetbrains.spek.extension.ExtensionRegistry
import java.util.*
import kotlin.reflect.KClass
/**
* @author Ranie Jade Ramiso
*/
class ExtensionRegistryImpl: ExtensionRegistry {
private val extensions: MutableMap, Extension> = HashMap()
override fun getExtension(extension: KClass): T? {
return extensions[extension] as T?
}
fun registerExtension(extension: T) {
if (!extensions.containsKey(extension.javaClass.kotlin)) {
extensions.put(extension.javaClass.kotlin, extension)
}
}
fun extensions(): Sequence = extensions.values.asSequence()
}