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

net.nemerosa.ontrack.job.JobKey.kt Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.job

import io.micrometer.core.instrument.Tag

data class JobKey(
        val type: JobType,
        val id: String
) {

    fun sameType(type: JobType): Boolean {
        return this.type == type
    }

    fun sameCategory(category: JobCategory): Boolean {
        return this.type.category == category
    }

    override fun toString(): String {
        return "$type[$id]"
    }

    val metricTags: List
        get() = listOf(
                Tag.of("job-type", type.key),
                Tag.of("job-category", type.category.key)
        )


    companion object {
        @JvmStatic
        fun of(type: JobType, id: String): JobKey {
            return JobKey(type, id)
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy