All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.name.remal.gradle_plugins.plugins.generate_sources.BaseGeneratingClassWriter.kt Maven / Gradle / Ivy

There is a newer version: 1.9.2
Show newest version
package name.remal.gradle_plugins.plugins.generate_sources

import java.io.File
import java.io.StringWriter
import java.io.Writer

abstract class BaseGeneratingClassWriter>(
    override val packageName: String,
    val simpleName: String,
    targetFile: File,
    relativePath: String,
    generateTask: BaseGenerateTask,
    delegate: Writer,
    protected val wrapDepth: Int = 0
) : GeneratingWriter(targetFile, relativePath, generateTask, delegate), GeneratingClassWriterInterface {

    protected abstract fun wrapStringWriter(stringWriter: StringWriter): Self

    override fun writeBlock(expression: String, blockAction: Self.() -> Unit) = writeBlock(this::wrapStringWriter, expression, blockAction)


    override fun toString(): String {
        if (wrapDepth == 0) {
            return super.toString()
        } else {
            return super.toString() + "(wrapDepth = $wrapDepth)"
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy