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

com.ybo.trackingplugin.tasks.utils.impl._CodeGeneratorKotlin.kt Maven / Gradle / Ivy

Go to download

gradle plugin allowing to add automatic logs (or other process) at the start of each traced method

There is a newer version: 0.6.2
Show newest version
package com.ybo.trackingplugin.tasks.utils.impl

import com.ybo.trackingplugin.tasks.data.TraceAnnotationMark
import com.ybo.trackingplugin.tasks.utils.CodeGenerator
import com.ybo.trackingplugin.toB64

class _CodeGeneratorKotlin : CodeGenerator() {
    override fun generate(
        params: String,
        tracerFactoryString: String,
        insideMethodIndentation: String,
        methodName: String,
        tag: String,
        alterationOffset: Int,
        mark: TraceAnnotationMark,
    ): String {
        return "/*$tag*/ $tracePerformerPackage.trace(" +
            tracerFactoryString + "(), " +
            "\"" + methodName.toB64() + "\", " +
            "false, " +
            "\"" + mark.longVersion.toB64() + "\"," +
            params.paramsOrNot() + "," +
            alterationOffset + ")\n" +
            insideMethodIndentation
    }

    private fun String.paramsOrNot(): String {
        return if (isEmpty()) {
            "emptyArray()"
        } else {
            "arrayOf($this) "
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy