class GlobalUniqueDataProvider: UniqueDataProvider

Global provider for unique values.

This provider is used in AbstractFaker class implementations to control global unique generation configuration of faker providers.

Example usage:


val faker = Faker()
faker.unique.configuration {
    enable(faker::address) // enables unique generation for all functions of Address provider
    enable(faker::name) // enables unique generation for all functions of Name provider
    exclude(listOfValues) // exclude values from `listOfValue` collection from being generated (for all providers that are enabled for unique generation)
    enable(faker::internet) { enables unique generation for all functions of Internet provider
        exclude(listOfValues) // exclude values from `listOfValue` collection from being generated with Internet provider
        exclude(faker::internet, listOfPatterns)
    }
}

Methods

disableAll

fun disableAll()

Disables "unique generation" for all providers that were configured to return unique values, and clears out any already returned values, so they can possibly be returned again.

ReturnValue

Name Description
Unit

clearAll

fun clearAll()

Clears the already returned (used) unique values and exclusion patterns so that values can again be returned.

ReturnValue

Name Description
Unit

clear

fun <T : FakeDataProvider> clear(providerProperty: KProperty0<T>)

Parameters

Name Description
providerProperty: KProperty0<T>

ReturnValue

Name Description
Unit

configuration

fun configuration(function: UniqueProviderConfiguration.()->Unit)

Configures this Unique provider.

Parameters

Name Description
function: UniqueProviderConfiguration.()->Unit

ReturnValue

Name Description
Unit