aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/CoreExtensions.kt
blob: 6a1af187d0c80de178f1d10324793c657b868c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package org.jetbrains.dokka

import org.jetbrains.dokka.model.SignatureProvider
import org.jetbrains.dokka.plugability.ExtensionPoint
import org.jetbrains.dokka.renderers.Renderer
import org.jetbrains.dokka.transformers.descriptors.DescriptorToDocumentableTranslator
import org.jetbrains.dokka.transformers.documentation.DocumentableMerger
import org.jetbrains.dokka.transformers.documentation.DocumentableToPageTranslator
import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer
import org.jetbrains.dokka.transformers.pages.PageTransformer
import org.jetbrains.dokka.transformers.psi.PsiToDocumentableTranslator
import kotlin.reflect.KProperty

object CoreExtensions {
    val descriptorToDocumentableTranslator by coreExtension<DescriptorToDocumentableTranslator>()
    val psiToDocumentableTranslator by coreExtension<PsiToDocumentableTranslator>()
    val documentableMerger by coreExtension<DocumentableMerger>()
    val documentableTransformer by coreExtension<DocumentableTransformer>()
    val documentableToPageTranslator by coreExtension<DocumentableToPageTranslator>()
    val pageTransformer by coreExtension<PageTransformer>()
    val renderer by coreExtension<Renderer>()
    val signatureProvider by coreExtension<SignatureProvider>()

    private fun <T : Any> coreExtension() = object {
        operator fun provideDelegate(thisRef: CoreExtensions, property: KProperty<*>): Lazy<ExtensionPoint<T>> =
            lazy { ExtensionPoint<T>(thisRef::class.qualifiedName!!, property.name) }
    }
}