All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lemonappdev.konsist.core.declaration.KoComplexDeclaration.kt Maven / Gradle / Ivy

Go to download

A Kotlin architecture test library. Define and guard code base consistency using Kotlin.

There is a newer version: 0.17.3
Show newest version
package com.lemonappdev.konsist.core.declaration

import com.lemonappdev.konsist.core.const.KoModifier
import com.lemonappdev.konsist.core.declaration.provider.KoClassProvider
import com.lemonappdev.konsist.core.declaration.provider.KoCompanionObjectProvider
import com.lemonappdev.konsist.core.declaration.provider.KoDeclarationProviderUtil
import com.lemonappdev.konsist.core.declaration.provider.KoFunctionProvider
import com.lemonappdev.konsist.core.declaration.provider.KoInterfaceProvider
import com.lemonappdev.konsist.core.declaration.provider.KoObjectProvider
import com.lemonappdev.konsist.core.declaration.provider.KoPropertyProvider
import org.jetbrains.kotlin.psi.KtClassOrObject

abstract class KoComplexDeclaration(
    private val ktClassOrObject: KtClassOrObject,
) : KoDeclaration(ktClassOrObject),
    KoClassProvider,
    KoInterfaceProvider,
    KoObjectProvider,
    KoCompanionObjectProvider,
    KoPropertyProvider,
    KoFunctionProvider {

    fun representsType(name: String) =
        name == fullyQualifiedName.substringAfterLast(".") || name == fullyQualifiedName

    inline fun representsType() = T::class.qualifiedName == fullyQualifiedName

    override fun declarations(
        modifiers: List,
        includeNested: Boolean,
        includeLocal: Boolean,
    ): List = KoDeclarationProviderUtil.getKoDeclarations(ktClassOrObject, modifiers, includeNested, includeLocal)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy