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

commonMain.com.saveourtool.save.domain.ProjectCoordinates.kt Maven / Gradle / Ivy

The newest version!
package com.saveourtool.save.domain

import kotlinx.serialization.Serializable

/**
 * @property organizationName name of organization
 * @property projectName name of project in this organization
 */
@Serializable
data class ProjectCoordinates(
    val organizationName: String,
    val projectName: String,
) {
    /**
     * @return ProjectCoordinates as formatted string "{organizationName}/{projectName}"
     */
    override fun toString() = "$organizationName/$projectName"

    /**
     * @return true if both [organizationName] and [projectName] are blank, false otherwise
     */
    fun consideredBlank() = organizationName.isBlank() || projectName.isBlank()

    companion object {
        val empty = ProjectCoordinates("", "")
    }
}

/**
 * @return [this] if not null, [ProjectCoordinates.empty] otherwise
 */
fun ProjectCoordinates?.orEmpty() = this ?: ProjectCoordinates.empty




© 2015 - 2025 Weber Informatics LLC | Privacy Policy