Comments (3)
I think @SerialInfo
from kotlinx.serialization could make it, like this:
@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!
}
from ktoml.
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
from ktoml.
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 :)
from ktoml.
Related Issues (20)
- Check the calculation of lineNo for nodes
- prettyPrint() for TomlNode is not working with multiline literal strings HOT 1
- Post-release: add iossimulator for ktoml-file
- Post-release: update documentation
- For multiline strings need to trim all spaces before separators
- Latest release requires ktoml-source to be added when ktoml-file is used
- Regression in 0.5.0 in escaping back slashes in strings HOT 2
- TomlTable.write() throws NoSuchElementException if children is empty HOT 1
- Add extra logic for validating enum values
- Can't parse simple toml with List HOT 2
- Exception when decoding map HOT 22
- Support for quoted keys and values with special symbols HOT 2
- Support for zero-item inline tables HOT 1
- Feature request: support value classes HOT 1
- Allow Missing Properties as a configuration option HOT 1
- Support new built-in types
- Why this library is not mentioned in official toml site? HOT 3
- encodeToString produces wrong indentation for case when there are nested List among the tree HOT 2
- How to deserialise Nested-Tables? HOT 1
- Fetch a primitive value with a TOML path, so I don't need to create my own classes HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ktoml.