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

io.github.serpro69.kfaker.books.provider.Tolkien.kt Maven / Gradle / Ivy

Go to download

Generate realistically looking fake data such as names, addresses, banking details, and many more, that can be used for testing and data anonymization purposes.

The newest version!
@file:Suppress("unused")

package io.github.serpro69.kfaker.books.provider

import io.github.serpro69.kfaker.FakerService
import io.github.serpro69.kfaker.dictionary.YamlCategory
import io.github.serpro69.kfaker.provider.FakeDataProvider
import io.github.serpro69.kfaker.provider.YamlFakeDataProvider
import io.github.serpro69.kfaker.provider.unique.LocalUniqueDataProvider
import io.github.serpro69.kfaker.provider.unique.UniqueProviderDelegate

/**
 * [FakeDataProvider] implementation for [YamlCategory.TOLKIEN] category.
 */
class Tolkien internal constructor(fakerService: FakerService) :
    YamlFakeDataProvider(fakerService) {
    override val yamlCategory = YamlCategory.TOLKIEN
    override val localUniqueDataProvider = LocalUniqueDataProvider()
    override val unique by UniqueProviderDelegate(localUniqueDataProvider, fakerService)

    init {
        fakerService.load(yamlCategory)
    }

    val lordOfTheRings by lazy { TolkienLordOfTheRings(fakerService) }

    val hobbit by lazy { TolkienHobbit(fakerService) }

    fun poems(): String = resolve("poems")
    fun locations(): String = resolve("locations")
    fun races(): String = resolve("races")
    fun characters(): String = resolve("characters")
}

class TolkienLordOfTheRings internal constructor(fakerService: FakerService) :
    YamlFakeDataProvider(fakerService) {
    override val yamlCategory = YamlCategory.TOLKIEN
    override val localUniqueDataProvider = LocalUniqueDataProvider()
    override val unique by UniqueProviderDelegate(localUniqueDataProvider, fakerService)

    init {
        fakerService.load(yamlCategory)
    }

    fun characters(): String = resolve("lord_of_the_rings", "characters")
    fun locations(): String = resolve("lord_of_the_rings", "locations")
    fun quotes(): String = resolve("lord_of_the_rings", "quotes")
}

class TolkienHobbit internal constructor(fakerService: FakerService) :
    YamlFakeDataProvider(fakerService) {
    override val yamlCategory = YamlCategory.TOLKIEN
    override val localUniqueDataProvider = LocalUniqueDataProvider()
    override val unique by UniqueProviderDelegate(localUniqueDataProvider, fakerService)

    init {
        fakerService.load(yamlCategory)
    }

    fun character(): String = resolve("hobbit", "character")
    fun thorinsCompany(): String = resolve("hobbit", "thorins_company")
    fun quote(): String = resolve("hobbit", "quote")
    fun location(): String = resolve("hobbit", "location")
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy