Item

sealed class Item<T>

Item that can be contained by config.

Item can be associated with value in config, containing metadata for the value. The metadata for value includes name, path, type, description and so on. Item can be used as key to operate value in config, guaranteeing type safety. There are three kinds of item: required item, optional item and lazy item.

See also

Parameters

T

type of value that can be associated with this item.

spec

config spec that contains this item

name

item name without prefix

description

description for this item

Functions

afterSet
Link copied to clipboard
fun afterSet(afterSetFunction: (config: Config, T) -> Unit): Handler
Subscribe the update event of this item after every set operation.
beforeSet
Link copied to clipboard
fun beforeSet(beforeSetFunction: (config: Config, T) -> Unit): Handler
Subscribe the update event of this item before every set operation.
notifyAfterSet
Link copied to clipboard
fun notifyAfterSet(config: Config, value: Any?)
notifyBeforeSet
Link copied to clipboard
fun notifyBeforeSet(config: Config, value: Any?)
notifySet
Link copied to clipboard
fun notifySet(value: Any?)
onSet
Link copied to clipboard
fun onSet(onSetFunction: (T) -> Unit): Handler
Subscribe the update event of this item.

Properties

asLazyItem
Link copied to clipboard
val asLazyItem: LazyItem<T>
Cast this item to a lazy item.
asOptionalItem
Link copied to clipboard
val asOptionalItem: OptionalItem<T>
Cast this item to an optional item.
asRequiredItem
Link copied to clipboard
val asRequiredItem: RequiredItem<T>
Cast this item to a required item.
description
Link copied to clipboard
val description: String
Description for this item.
isLazy
Link copied to clipboard
open val isLazy: Boolean
Whether this is a lazy item or not.
isOptional
Link copied to clipboard
open val isOptional: Boolean
Whether this is an optional item or not.
isRequired
Link copied to clipboard
open val isRequired: Boolean
Whether this is a required item or not.
name
Link copied to clipboard
val name: String
Item name without prefix.
nullable
Link copied to clipboard
val nullable: Boolean = false
path
Link copied to clipboard
val path: Path
Item path without prefix.
spec
Link copied to clipboard
val spec: Spec
Config spec that contains this item.
type
Link copied to clipboard
val type: JavaType
Type of value that can be associated with this item.

Inheritors

RequiredItem
Link copied to clipboard
OptionalItem
Link copied to clipboard
LazyItem
Link copied to clipboard

Extensions

asName
Link copied to clipboard
val Item<*>.asName: String

Sources

jvm source
Link copied to clipboard