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

com.likethesalad.tools.resource.api.android.parser.SealedParser.kt Maven / Gradle / Ivy

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

abstract class SealedParser {

    private val objectItems: List by lazy {
        getSealedObjects().toList()
    }

    fun fromId(id: String): T {
        return objectItems.firstOrNull { it.getSealedItemId() == id }
            ?: createUnknown(id)
    }

    protected abstract fun createUnknown(id: String): T
    internal abstract fun getSealedObjects(): Set
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy