commonMain.com.seiko.imageloader.component.ComponentRegistryBuilder.kt Maven / Gradle / Ivy
package com.seiko.imageloader.component
import com.seiko.imageloader.component.decoder.Decoder
import com.seiko.imageloader.component.fetcher.Fetcher
import com.seiko.imageloader.component.keyer.Keyer
import com.seiko.imageloader.component.mapper.Mapper
class ComponentRegistryBuilder {
private val mappers = mutableListOf>()
private val keyers = mutableListOf()
private val fetcherFactories = mutableListOf()
private val decoderFactories = mutableListOf()
fun add(mapper: Mapper) = apply {
mappers.add(mapper)
}
fun add(keyer: Keyer) = apply {
keyers.add(keyer)
}
fun add(fetcherFactory: Fetcher.Factory) = apply {
fetcherFactories.add(fetcherFactory)
}
fun add(decoderFactory: Decoder.Factory) = apply {
decoderFactories.add(decoderFactory)
}
fun build(): ComponentRegistry = ComponentRegistry(
mappers = mappers,
keyers = keyers,
fetcherFactories = fetcherFactories,
decoderFactories = decoderFactories,
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy