Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 13 days ago
JSON representation

A kotlin compiler plugin to generate toString like data class.

Awesome Lists containing this project

README

        

Auto ToString Kotlin Compiler Plugin
====

[![a12 maintenance: Slowly](https://api.anatawa12.com/short/a12-slowly-svg)](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.