Last active
July 18, 2021 09:21
-
-
Save Morfly/dac5f35b7d564c39bd14f3bc3a33aa1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun visitClassDeclaration(classDeclaration: KSClassDeclaration, data: Unit) { | |
if (classDeclaration.classKind != ClassKind.INTERFACE) { | |
logger.error("Only interface can be annotated with @Function", classDeclaration) | |
return | |
} | |
// Getting the @Function annotation object. | |
val annotation: KSAnnotation = classDeclaration.annotations.first { | |
it.shortName.asString() == "Function" | |
} | |
// Getting the 'name' argument object from the @Function. | |
val nameArgument: KSValueArgument = annotation.arguments | |
.first { arg -> arg.name?.asString() == "name" } | |
// Getting the value of the 'name' argument. | |
val functionName = nameArgument.value as String | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment