Skip to content

Instantly share code, notes, and snippets.

@SeongUgJung
Last active February 20, 2021 05:50
Show Gist options
  • Save SeongUgJung/7738b81a5462b4824032d8398aa53bba to your computer and use it in GitHub Desktop.
Save SeongUgJung/7738b81a5462b4824032d8398aa53bba to your computer and use it in GitHub Desktop.
private val targets = mutableListOf<KSClassDeclaration>()
override fun process(resolver: Resolver): List<KSAnnotated> {
// read @JsonClass annoted class
val symbols = resolver.getSymbolsWithAnnotation("com.squareup.moshi.JsonClass")
symbols.filter { ksAnnotated ->
// only filter out class.
ksAnnotated is KSClassDeclaration && ksAnnotated.validate()
}
.forEach { kSClassDeclaration ->
// look browse class information via CustomKSVisitor
kSClassDeclaration.accept(CustomKSVisitor(targets), Unit)
}
return emptyList()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment