Skip to content

fr: ultra-simplified version using delegates #34

@salamanders

Description

@salamanders

I think that this would be an easy feature given the great foundation in this project, and what Kotlin can do with delegates.

In my class, I'd like to have magic delegated properties that take into account everything (SystemProperties, EnvironmentVariables, command line, and default values). I think it would be possible to do so in a way that a single import is all you need:

import com.natpryce.konfig.byConfig

class MyClass {
  val speed:Double = byConfig(0.0)
  val name:String = byConfig("Larry")
  init {
    println("My name is $name because of ${::name.source}")
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions