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

com.likethesalad.tools.resource.api.android.environment.Variant.kt Maven / Gradle / Ivy

package com.likethesalad.tools.resource.api.android.environment

import com.likethesalad.tools.resource.api.android.parser.SealedParseable
import com.likethesalad.tools.resource.api.android.parser.SealedParser

sealed class Variant(val name: String) : SealedParseable {
    object Default : Variant("main")
    object Dependency : Variant("--dependency--")
    class Custom(name: String) : Variant(name)

    override fun getSealedItemId(): String {
        return name
    }

    override fun hashCode(): Int {
        return name.hashCode()
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is Variant) return false

        if (name != other.name) return false

        return true
    }

    companion object : SealedParser() {
        override fun createUnknown(id: String): Variant {
            return Custom(id)
        }

        override fun getSealedObjects(): Set {
            return setOf(Default, Dependency)
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy