Package com.uchuhimo.konf

Types

BaseConfig
Link copied to clipboard
open class BaseConfig(name: String, parent: BaseConfig?, mapper: ObjectMapper, specsInLayer: MutableList<Spec>, featuresInLayer: MutableMap<Feature, Boolean>, nodeByItem: MutableMap<Item<*>, BaseConfig.ItemNode>, tree: TreeNode, hasChildren: BaseConfig.Value<Boolean>, beforeSetFunctions: MutableList<(item: Item<*>, value: Any?) -> Unit>, afterSetFunctions: MutableList<(item: Item<*>, value: Any?) -> Unit>, beforeLoadFunctions: MutableList<(source: Source) -> Unit>, afterLoadFunctions: MutableList<(source: Source) -> Unit>, lock: ReentrantReadWriteLock) : Config
The default implementation for Config.
Config
Link copied to clipboard
interface Config : ItemContainer
Config containing items and associated values.
ConfigException
Link copied to clipboard
open class ConfigException : RuntimeException
Exception for config.
Configs
Link copied to clipboard
class Configs
Helper class for Config.
ConfigSpec
Link copied to clipboard
open class ConfigSpec @JvmOverloads() constructor(prefix: String?, items: Set<Item<*>>, innerSpecs: Set<Spec>) : Spec
The default implementation for Spec.
ContainerNode
Link copied to clipboard
open class ContainerNode(children: MutableMap<String, TreeNode>, isPlaceHolder: Boolean) : MapNode
Tree node that contains children nodes.
EmptyNode
Link copied to clipboard
object EmptyNode : LeafNode
Tree node that represents a empty tree.
Feature
Link copied to clipboard
enum Feature : Enum<Feature>
Enumeration that defines simple on/off features.
GetDefaultValueException
Link copied to clipboard
class GetDefaultValueException(name: String) : ConfigException
Exception indicates that the specified item has default value.
Handler
Link copied to clipboard
interface Handler : AutoCloseable
InvalidLazySetException
Link copied to clipboard
class InvalidLazySetException(message: String) : ConfigException
Exception indicates that the evaluated result of lazy thunk is invalid.
InvalidPathException
Link copied to clipboard
class InvalidPathException(path: String) : ConfigException
Exception indicates that the specified path is invalid.
Item
Link copied to clipboard
sealed class Item<T>
Item that can be contained by config.
ItemContainer
Link copied to clipboard
interface ItemContainer : Iterable<Item<*>>
Container of items.
LayerFrozenException
Link copied to clipboard
class LayerFrozenException(config: Config) : ConfigException
Exception indicates that item cannot be added to this config because it has child layer.
LazyConfigProperty
Link copied to clipboard
open class LazyConfigProperty<T>(config: Config, thunk: (config: ItemContainer) -> T, prefix: String, name: String?, description: String, nullable: Boolean) : PropertyDelegateProvider<Any?, ReadWriteProperty<Any?, T>>
LazyItem
Link copied to clipboard
open class LazyItem<T@JvmOverloads() constructor(spec: Spec, name: String, thunk: (config: ItemContainer) -> T, description: String, type: JavaType?, nullable: Boolean) : Item<T>
Lazy item evaluated value every time from thunk before associated with specified value.
LazyProperty
Link copied to clipboard
open class LazyProperty<T>(spec: Spec, thunk: (config: ItemContainer) -> T, name: String?, description: String, nullable: Boolean) : PropertyDelegateProvider<Any?, ReadOnlyProperty<Any?, LazyItem<T>>>
LeafNode
Link copied to clipboard
interface LeafNode : TreeNode
ListNode
Link copied to clipboard
interface ListNode : LeafNode
MapNode
Link copied to clipboard
interface MapNode : TreeNode
MergedConfig
Link copied to clipboard
open class MergedConfig(fallback: BaseConfig, facade: BaseConfig) : BaseConfig
Config that merge fallback and facade.
MergedMap
Link copied to clipboard
class MergedMap<K, V>(fallback: MutableMap<K, V>, facade: MutableMap<K, V>) : MutableMap<K, V>
NameConflictException
Link copied to clipboard
class NameConflictException(message: String) : ConfigException
Exception indicates that there is existed item with conflicted name in config.
NoSuchItemException
Link copied to clipboard
class NoSuchItemException(name: String) : ConfigException
Exception indicates that the specified item is not in this config.
NoSuchPathException
Link copied to clipboard
class NoSuchPathException(path: String) : ConfigException
Exception indicates that expected value in specified path is not existed in the source.
NullNode
Link copied to clipboard
interface NullNode : LeafNode
OptionalConfigProperty
Link copied to clipboard
open class OptionalConfigProperty<T>(config: Config, default: T, prefix: String, name: String?, description: String, nullable: Boolean) : PropertyDelegateProvider<Any?, ReadWriteProperty<Any?, T>>
OptionalItem
Link copied to clipboard
open class OptionalItem<T@JvmOverloads() constructor(spec: Spec, name: String, default: T, description: String, type: JavaType?, nullable: Boolean) : Item<T>
Optional item with default value.
OptionalProperty
Link copied to clipboard
open class OptionalProperty<T>(spec: Spec, default: T, name: String?, description: String, nullable: Boolean) : PropertyDelegateProvider<Any?, ReadOnlyProperty<Any?, OptionalItem<T>>>
Path
Link copied to clipboard
typealias Path = List<String>

Type of Item path.

PathConflictException
Link copied to clipboard
class PathConflictException(path: String) : ConfigException
Exception indicates that the specified path conflicts with existed paths in the tree node.
Prefix
Link copied to clipboard
data class Prefix(path: String)
Convenient class for constructing Spec/Config/Source with prefix.
RepeatedInnerSpecException
Link copied to clipboard
class RepeatedInnerSpecException(spec: Spec) : ConfigException
Exception indicates that there is existed inner spec in config.
RepeatedItemException
Link copied to clipboard
class RepeatedItemException(name: String) : ConfigException
Exception indicates that there is existed item with same name in config.
RequiredConfigProperty
Link copied to clipboard
open class RequiredConfigProperty<T>(config: Config, prefix: String, name: String?, description: String, nullable: Boolean) : PropertyDelegateProvider<Any?, ReadWriteProperty<Any?, T>>
RequiredItem
Link copied to clipboard
open class RequiredItem<T@JvmOverloads() constructor(spec: Spec, name: String, description: String, type: JavaType?, nullable: Boolean) : Item<T>
Required item without default value.
RequiredProperty
Link copied to clipboard
open class RequiredProperty<T>(spec: Spec, name: String?, description: String, nullable: Boolean) : PropertyDelegateProvider<Any?, ReadOnlyProperty<Any?, RequiredItem<T>>>
SizeInBytes
Link copied to clipboard
data class SizeInBytes(bytes: Long) : Serializable
Represents size in unit of bytes.
Spec
Link copied to clipboard
interface Spec
Config spec is specification for config.
TreeNode
Link copied to clipboard
interface TreeNode
Tree node that represents internal structure of config/source.
UnsetValueException
Link copied to clipboard
class UnsetValueException(name: String) : ConfigException
Exception indicates that the specified item is in unset state.
ValueNode
Link copied to clipboard
interface ValueNode : LeafNode

Functions

cast
Link copied to clipboard
inline fun <T> Config.cast(): RequiredConfigProperty<T>
Returns a property that can read/set associated value casted from config.
checkPath
Link copied to clipboard
fun checkPath(path: String)
createDefaultMapper
Link copied to clipboard
fun createDefaultMapper(): ObjectMapper
Returns a new default object mapper for config.
lazy
Link copied to clipboard
inline fun <T> Spec.lazy(name: String? = null, description: String = "", noinline thunk: (config: ItemContainer) -> T): LazyProperty<T>
Specify a lazy item in this config spec.
inline fun <T> Config.lazy(prefix: String = "", name: String? = null, description: String = "", noinline thunk: (config: ItemContainer) -> T): LazyConfigProperty<T>
Returns a property that can read/set associated value for specified lazy item.
notEmptyOr
Link copied to clipboard
fun String.notEmptyOr(default: String): String
Returns default value if string is empty, original string otherwise.
optional
Link copied to clipboard
inline fun <T> Spec.optional(default: T, name: String? = null, description: String = ""): OptionalProperty<T>
Specify an optional item in this config spec.
inline fun <T> Config.optional(default: T, prefix: String = "", name: String? = null, description: String = ""): OptionalConfigProperty<T>
Returns a property that can read/set associated value for specified optional item.
required
Link copied to clipboard
inline fun <T> Spec.required(name: String? = null, description: String = ""): RequiredProperty<T>
Specify a required item in this config spec.
inline fun <T> Config.required(prefix: String = "", name: String? = null, description: String = ""): RequiredConfigProperty<T>
Returns a property that can read/set associated value for specified required item.
tempDirectory
Link copied to clipboard
fun tempDirectory(prefix: String = "tmp", suffix: String? = null, directory: File? = null): File
tempFile
Link copied to clipboard
fun tempFile(prefix: String = "tmp", suffix: String? = null, directory: File? = null): File
toCamelCase
Link copied to clipboard
fun String.toCamelCase(): String
Modified implementation from org.apache.commons.text.CaseUtils.toCamelCase.
toLittleCamelCase
Link copied to clipboard
fun String.toLittleCamelCase(): String
toLittleCase
Link copied to clipboard
fun String.toLittleCase(): String
toPath
Link copied to clipboard
fun String.toPath(): Path
Returns corresponding item path of the item name.
toSizeInBytes
Link copied to clipboard
fun String.toSizeInBytes(): SizeInBytes
Converts a string to SizeInBytes.
toTree
Link copied to clipboard
fun Config.toTree(): TreeNode
Convert the config to a tree node.
toValue
Link copied to clipboard
inline fun <T> Config.toValue(): T
Returns a value casted from config.
unsupported
Link copied to clipboard
inline fun unsupported(): Nothing

Properties

asName
Link copied to clipboard
val Item<*>.asName: String
emptyMutableMap
Link copied to clipboard
val emptyMutableMap: MutableMap<String, TreeNode>
name
Link copied to clipboard
val Path.name: String
Returns corresponding item name of the item path.