https://github.com/anatawa12/auto-tostring
A kotlin compiler plugin to generate toString like data class.
https://github.com/anatawa12/auto-tostring
compiler-plugin kotlin kotlin-compiler-plugin
Last synced: 5 months ago
JSON representation
A kotlin compiler plugin to generate toString like data class.
- Host: GitHub
- URL: https://github.com/anatawa12/auto-tostring
- Owner: anatawa12
- License: mit
- Created: 2021-03-31T05:13:59.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-16T02:29:41.000Z (over 3 years ago)
- Last Synced: 2025-04-07T17:34:00.758Z (about 1 year ago)
- Topics: compiler-plugin, kotlin, kotlin-compiler-plugin
- Language: Kotlin
- Homepage:
- Size: 136 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Auto ToString Kotlin Compiler Plugin
====
[](https://api.anatawa12.com/short/a12-slowly-doc)
A kotlin compiler plugin to generate toString like data class.
## How to use
First, you need to apply this gradle plugin
```kotlin
plugins {
id("org.jetbrains.kotlin.jvm") version ""
id("com.anatawa12.auto-tostring") version ""
}
```
To add compile-time library, add code below:
```groovy
autoToString {
// for compileOnly configuration
addLib()
// for CompileOnly configuration
addLib "sourceSet"
addLib sourceSet: "sourceSet"
// for your configuration
addLib configuration: "yourConfiguration"
}
```
To generate toString function, add ``@AutoToString`` annotation to class.
## Extra features
For `kotlin.String` or string it typed fields, This plugin surrounded the value with `"`
like `SomeClass(value="string body")` and also surrounded with `'` for `kotlin.Char`s.
You can customize wrapping with `@SurroundedWith(begin=, end=)`. see KDoc for more details.