All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.spek.engine.extension.ExtensionRegistryImpl.kt Maven / Gradle / Ivy

There is a newer version: 1.1.5
Show newest version
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()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy