ProviderOption

open class ProviderOption<T : Any> @InternalWowApi constructor(val key: String, val description: String, val type: Class<T>, val default: T?, val scope: ProviderOption.Scope, val values: List<String> = emptyList(), parser: (String) -> T)

One setting a provider (a store's, a dataset backend's) reads from its configuration, as it declares it: its key, what it means (description, the configuration reference's text), the type of its value and its default (null when it has none), and where it may be set (scope). A provider lists every option it reads, and reads each through it, so the host binds, checks and documents exactly those: an option of Scope.TYPE is set for every instance of the provider's type under wow.<type>.<key>, and each instance may set it over that; a key a provider does not declare fails the start, naming the declared ones.

A provider declares its options with the factories (string, duration, int, boolean, enumeration, map). Given a default, a factory returns a Defaulted option, which a config reads as a value that is always there (config.option(o) is a T); without one, the value may be missing (a T?). A map option is a prefix whose sub-keys pass through as they are (properties.* of a client): a config reads it with its options(option). An enumeration lists its values, which the host's configuration metadata offers as hints.

Inheritors

Constructors

Link copied to clipboard
constructor(key: String, description: String, type: Class<T>, default: T?, scope: ProviderOption.Scope, values: List<String> = emptyList(), parser: (String) -> T)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class Defaulted<T : Any> @InternalWowApi constructor(key: String, description: String, type: Class<T>, val default: T, scope: ProviderOption.Scope, values: List<String> = emptyList(), parser: (String) -> T) : ProviderOption<T>

An option with a default: a config reads its value, set or not, as a T.

Link copied to clipboard

Where an option may be set.

Properties

Link copied to clipboard
open val default: T?
Link copied to clipboard
Link copied to clipboard

Whether this option is a prefix of free sub-keys (map).

Link copied to clipboard
val key: String
Link copied to clipboard
Link copied to clipboard
val type: Class<T>
Link copied to clipboard

The values it takes, for an enumeration; empty for any other option.

Functions

Link copied to clipboard
fun parse(text: String, where: String): T

text as this option's value; fails naming where, the key it was set under, when it is not one.

Link copied to clipboard

This option, settable only on one store instance (Scope.PER_STORE).

Link copied to clipboard
open override fun toString(): String