Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
osoykan committed Oct 28, 2024
1 parent a606b93 commit 77afc79
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import org.springframework.context.annotation.Bean
@AutoConfiguration
open class KediatRAutoConfiguration {
@Bean
open fun kediatRSpringBeanProvider(applicationContext: ApplicationContext): KediatRSpringBeanProvider {
return KediatRSpringBeanProvider(applicationContext)
}
open fun kediatRSpringBeanProvider(
applicationContext: ApplicationContext
): KediatRSpringBeanProvider = KediatRSpringBeanProvider(applicationContext)

@Bean
open fun mediator(kediatRSpringBeanProvider: KediatRSpringBeanProvider): Mediator {
return MediatorBuilder(kediatRSpringBeanProvider).build()
}
open fun mediator(
kediatRSpringBeanProvider: KediatRSpringBeanProvider
): Mediator = MediatorBuilder(kediatRSpringBeanProvider).build()
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import org.springframework.context.ApplicationContext
class KediatRSpringBeanProvider(
private val applicationContext: ApplicationContext
) : DependencyProvider {
override fun <T> getSingleInstanceOf(clazz: Class<T>): T {
return applicationContext.getBean(clazz)
}
override fun <T> getSingleInstanceOf(clazz: Class<T>): T = applicationContext.getBean(clazz)

override fun <T> getSubTypesOf(clazz: Class<T>): Collection<Class<T>> {
return applicationContext.getBeanNamesForType(clazz)
.map { applicationContext.getType(it) as Class<T> }
}
override fun <T> getSubTypesOf(
clazz: Class<T>
): Collection<Class<T>> = applicationContext
.getBeanNamesForType(clazz)
.map { applicationContext.getType(it) as Class<T> }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import org.springframework.context.annotation.Bean
@AutoConfiguration
open class KediatRAutoConfiguration {
@Bean
open fun kediatRSpringBeanProvider(applicationContext: ApplicationContext): KediatRSpringBeanProvider {
return KediatRSpringBeanProvider(applicationContext)
}
open fun kediatRSpringBeanProvider(
applicationContext: ApplicationContext
): KediatRSpringBeanProvider = KediatRSpringBeanProvider(applicationContext)

@Bean
open fun mediator(kediatRSpringBeanProvider: KediatRSpringBeanProvider): Mediator {
return MediatorBuilder(kediatRSpringBeanProvider).build()
}
open fun mediator(
kediatRSpringBeanProvider: KediatRSpringBeanProvider
): Mediator = MediatorBuilder(kediatRSpringBeanProvider).build()
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import org.springframework.context.ApplicationContext
class KediatRSpringBeanProvider(
private val applicationContext: ApplicationContext
) : DependencyProvider {
override fun <T> getSingleInstanceOf(clazz: Class<T>): T {
return applicationContext.getBean(clazz)
}
override fun <T> getSingleInstanceOf(clazz: Class<T>): T = applicationContext.getBean(clazz)

override fun <T> getSubTypesOf(clazz: Class<T>): Collection<Class<T>> {
return applicationContext.getBeanNamesForType(clazz)
.map { applicationContext.getType(it) as Class<T> }
}
override fun <T> getSubTypesOf(
clazz: Class<T>
): Collection<Class<T>> = applicationContext
.getBeanNamesForType(clazz)
.map { applicationContext.getType(it) as Class<T> }
}

0 comments on commit 77afc79

Please sign in to comment.