Add default implementation to the provider.

This commit is contained in:
Alexander Nozik 2020-07-26 17:36:18 +03:00
parent 34110f6be1
commit b5b0a6898e
2 changed files with 1 additions and 5 deletions

View File

@ -30,8 +30,6 @@ abstract class AbstractPlugin(override val meta: Meta = Meta.EMPTY) : Plugin {
dependencies.add(factory) dependencies.add(factory)
return PluginDependencyDelegate(factory.type) return PluginDependencyDelegate(factory.type)
} }
override fun provideTop(target: String): Map<Name, Any> = emptyMap()
} }
fun <T : Named> Collection<T>.toMap(): Map<Name, T> = associate { it.name to it } fun <T : Named> Collection<T>.toMap(): Map<Name, T> = associate { it.name to it }

View File

@ -39,12 +39,10 @@ interface Provider {
*/ */
val defaultChainTarget: String get() = "" val defaultChainTarget: String get() = ""
/** /**
* A map of direct children for specific target * A map of direct children for specific target
*/ */
fun provideTop(target: String): Map<Name, Any> = fun provideTop(target: String): Map<Name, Any> = emptyMap()
throw IllegalArgumentException("Target $target is not supported for $this")
} }
fun Provider.provide(path: Path, targetOverride: String? = null): Any? { fun Provider.provide(path: Path, targetOverride: String? = null): Any? {