mirror of
https://github.com/InsanusMokrassar/SDI.git
synced 2024-06-01 23:45:12 +00:00
19 lines
601 B
Kotlin
19 lines
601 B
Kotlin
package dev.inmo.sdi
|
|
|
|
import com.github.matfax.klassindex.IndexAnnotated
|
|
import com.github.matfax.klassindex.KlassIndex
|
|
import kotlin.reflect.KClass
|
|
|
|
@Retention(AnnotationRetention.RUNTIME)
|
|
@Target(AnnotationTarget.CLASS)
|
|
@IndexAnnotated
|
|
actual annotation class SDIIncluded actual constructor(actual val customNames: Array<String>)
|
|
|
|
internal actual fun getClassesForIncludingInSDI(): List<Pair<KClass<*>, List<String>>> = KlassIndex.getAnnotated(
|
|
SDIIncluded::class
|
|
).map {
|
|
it.let {
|
|
it to it.annotations.flatMap { (it as? SDIIncluded) ?.customNames ?.toList() ?: emptyList() }
|
|
}
|
|
}
|