Source

interface Source

Source to provide values for config.

When config loads values from source, config will iterate all items in it, and retrieve value with path of each item from source. When source contains single value, a series of is operations can be used to judge the actual type of value, and to operation can be used to get the value with specified type. When source contains multiple value, contains operations can be used to check whether value(s) in specified path is in this source, and get operations can be used to retrieve the corresponding sub-source.

Types

Companion
Link copied to clipboard
object Companion

Functions

contains
Link copied to clipboard
open operator fun contains(prefix: String): Boolean
Whether this source contains value(s) with specified prefix or not.
open operator fun contains(path: Path): Boolean
Whether this source contains value(s) in specified path or not.
disabled
Link copied to clipboard
open fun disabled(feature: Feature): Source
Returns a new source that disables the specified feature.
enabled
Link copied to clipboard
open fun enabled(feature: Feature): Source
Returns a new source that enables the specified feature.
get
Link copied to clipboard
open operator fun get(path: String): Source
Returns sub-source in specified path.
open operator fun get(path: Path): Source
Returns sub-source in specified path.
getNodeOrNull
Link copied to clipboard
open fun getNodeOrNull(path: Path, lowercased: Boolean = false, littleCamelCased: Boolean = true): TreeNode?
getOrNull
Link copied to clipboard
open fun getOrNull(path: String): Source?
Returns sub-source in specified path if this source contains value(s) in specified path, null otherwise.
open fun getOrNull(path: Path): Source?
Returns sub-source in specified path if this source contains value(s) in specified path, null otherwise.
isEnabled
Link copied to clipboard
open fun isEnabled(feature: Feature): Boolean
Check whether the specified feature is enabled or not.
littleCamelCased
Link copied to clipboard
open fun littleCamelCased(enabled: Boolean = true): Source
lowercased
Link copied to clipboard
open fun lowercased(enabled: Boolean = false): Source
normalized
Link copied to clipboard
open fun normalized(lowercased: Boolean = false, littleCamelCased: Boolean = true): Source
plus
Link copied to clipboard
open operator fun plus(facade: Source): Source
Returns a source overlapped by the specified facade source.
substituted
Link copied to clipboard
open fun substituted(root: Source = this, enabled: Boolean = true, errorWhenUndefined: Boolean = true): Source
Return a source that substitutes path variables within all strings by values.
withFallback
Link copied to clipboard
open fun withFallback(fallback: Source): Source
Returns a source backing by specified fallback source.
withPrefix
Link copied to clipboard
open fun withPrefix(prefix: String): Source
Returns source with specified additional prefix.
open fun withPrefix(prefix: Path): Source
Returns source with specified additional prefix.

Properties

description
Link copied to clipboard
open val description: String
Description of this source.
features
Link copied to clipboard
open val features: Map<Feature, Boolean>
Feature flags in this source.
info
Link copied to clipboard
abstract val info: SourceInfo
Information about this source.
tree
Link copied to clipboard
abstract val tree: TreeNode
a tree node that represents internal structure of this source.

Inheritors

MergedSource
Link copied to clipboard
BaseSource
Link copied to clipboard
FlatSource
Link copied to clipboard
ValueSource
Link copied to clipboard
JsonSource
Link copied to clipboard

Extensions

asValue
Link copied to clipboard
inline fun <T> Source.asValue(): T
toValue
Link copied to clipboard
inline fun <T> Source.toValue(): T
Returns a value casted from source.

Sources

jvm source
Link copied to clipboard