Skip to content

Instantly share code, notes, and snippets.

@SeongUgJung
Created February 20, 2021 05:59
Show Gist options
  • Save SeongUgJung/acfd12ea849935563fff50f2b6b334bf to your computer and use it in GitHub Desktop.
Save SeongUgJung/acfd12ea849935563fff50f2b6b334bf to your computer and use it in GitHub Desktop.
override fun visitClassDeclaration(classDeclaration: KSClassDeclaration, data: Unit) {
classDeclaration.annotations.firstOrNull { annotation ->
// filter only JsonClass
annotation.shortName.asString() == "JsonClass"
}?.arguments?.firstOrNull { argument ->
// check @JsonClass(generateAdapter = true)
argument.name?.asString() == "generateAdapter" && argument.value == true
}
?.let {
// collect class to use in SymbolProcessor.finish()
targets.add(classDeclaration)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment