Skip to content
diskria-libsPublic

About

A Kotlin-first library bridging KotlinPoet and JavaPoet with interoperability converters and elegant DSL builders.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Poetesse

A Kotlin-first library bridging KotlinPoet and JavaPoet with interoperability converters and elegant DSL builders.

Maven Central License: MIT


Example of usage:

poetesse {
    val argsType = xType<String>().array()
    val message = "Hello, World!"
    java.file("com.example", "HelloJava") {
        class_(fileName) {
            public()
            method("main") {
                static()
                parameter("args", argsType)
                body {
                    line { "${T<System>()}.out.println(${S(message)})" }
                }
            }
        }
    }.writeTo(System.out)

    kotlin.file("com.example", "HelloKotlin") {
        function("main") {
            parameter("args", argsType)
            body {
                line { "println(${S(message)})" }
            }
        }
    }.writeTo(System.out)
}

Output:

package com.example;

import java.lang.String;
import java.lang.System;

public class HelloJava {
    static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
package com.example

import kotlin.Array
import kotlin.String

public fun main(args: Array<String>) {
    println("Hello, World!")
}

License

This project is licensed under the MIT License.

About

A Kotlin-first library bridging KotlinPoet and JavaPoet with interoperability converters and elegant DSL builders.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages