-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A good idea is to use annotation processing with reflekt for the configuration #79
Comments
I think @SerialInfo
@Target(AnnotationTarget.PROPERTY)
public annotation class Comment(vararg val texts: String)
// Model class
data class Account(
val username: String,
@Comment("Don't tell others!")
val password: String
)
// In Encoder
fun comment(descriptor: SerialDescriptor, index: Int) {
descriptor.getElementAnnotations(index)
.filterIsInstance<Comment>()
.map {
if (it.isEmpty())
emptyArray<String>()
else
it[0].texts // As Comment is not @Repeatable, we take the first
}
.forEach(writer::emitComment) // functional YES!
} |
Yes, I think this is covered by kotlinx.serialization already. I'm not sure what functionality Reflekt would provide that we don't have access to, but I could be missing something |
Yeah, it looks so. I actually wanted to add some custom annotations for compile time reflection, but yes Kotlinx.serialization already has mostly everything we need. May be we will use reflekt for something else next time :) |
https://github.com/JetBrains-Research/reflekt
The text was updated successfully, but these errors were encountered: