mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-17 13:53:49 +00:00
fix in koin generator
This commit is contained in:
parent
dfd6fe062d
commit
786cf9bd8b
@ -2,6 +2,10 @@
|
||||
|
||||
## 0.19.4
|
||||
|
||||
* `Koin`
|
||||
* `Generator`
|
||||
* Fixes in new generic generator part
|
||||
|
||||
## 0.19.3
|
||||
|
||||
* `Koin`
|
||||
|
@ -127,7 +127,7 @@ class Processor(
|
||||
addModifiers(KModifier.INLINE)
|
||||
targetTypeAsGenericType ?.let {
|
||||
addTypeVariable(it)
|
||||
returns(it)
|
||||
returns(it.copy(nullable = nullable))
|
||||
} ?: returns(targetType)
|
||||
addCode(
|
||||
"return " + (if (nullable) {
|
||||
|
@ -97,3 +97,28 @@ public inline fun <reified T : Any> Module.singleTest(createdAtStart: Boolean =
|
||||
*/
|
||||
public inline fun <reified T : Any> Module.factoryTest(noinline definition: Definition<T>):
|
||||
KoinDefinition<T> = factory(named("test"), definition = definition)
|
||||
|
||||
/**
|
||||
* @return Definition by key "testNullable" with [parameters]
|
||||
*/
|
||||
public inline fun <reified T : Any> Scope.testNullable(noinline parameters: ParametersDefinition? =
|
||||
null): T? = getOrNull(named("testNullable"), parameters)
|
||||
|
||||
/**
|
||||
* @return Definition by key "testNullable" with [parameters]
|
||||
*/
|
||||
public inline fun <reified T : Any> Koin.testNullable(noinline parameters: ParametersDefinition? =
|
||||
null): T? = getOrNull(named("testNullable"), parameters)
|
||||
|
||||
/**
|
||||
* Will register [definition] with [org.koin.core.module.Module.single] and key "testNullable"
|
||||
*/
|
||||
public inline fun <reified T : Any> Module.singleTestNullable(createdAtStart: Boolean = false,
|
||||
noinline definition: Definition<T>): KoinDefinition<T> = single(named("testNullable"),
|
||||
createdAtStart = createdAtStart, definition = definition)
|
||||
|
||||
/**
|
||||
* Will register [definition] with [org.koin.core.module.Module.factory] and key "testNullable"
|
||||
*/
|
||||
public inline fun <reified T : Any> Module.factoryTestNullable(noinline definition: Definition<T>):
|
||||
KoinDefinition<T> = factory(named("testNullable"), definition = definition)
|
||||
|
@ -1,5 +1,6 @@
|
||||
@file:GenerateKoinDefinition("sampleInfo", Test::class, String::class, nullable = false)
|
||||
@file:GenerateGenericKoinDefinition("test", nullable = false)
|
||||
@file:GenerateGenericKoinDefinition("testNullable", nullable = true)
|
||||
package dev.inmo.micro_utils.koin.generator.test
|
||||
|
||||
import dev.inmo.micro_utils.koin.annotations.GenerateGenericKoinDefinition
|
||||
|
Loading…
Reference in New Issue
Block a user