gs-config/src/main/scala/gs/config/v0/ConfigKey.scala
Pat Garrity 50944ff6f0
All checks were successful
/ Build and Test Library Snapshot (pull_request) Successful in 2m1s
Version updates and minor fixes.
2025-07-27 21:56:07 -05:00

41 lines
1.1 KiB
Scala

package gs.config.v0
/** Defines some piece of configuration.
*
* See:
*
* - [[ConfigKey.Required]]
* - [[ConfigKey.WithDefaultValue]]
*
* @tparam A
* The type of data referenced by this key. This type must be
* [[Configurable]].
*/
sealed trait ConfigKey[A]:
def name: ConfigName
object ConfigKey:
/** Defines a piece of configuration that is required and does not have any
* default value. If the value referenced by the name cannot be found, an
* [[ConfigError.MissingValue]] is returned.
*
* @param name
* The name of this configuration.
*/
case class Required[A](
name: ConfigName
) extends ConfigKey[A]
/** Defines a piece of configuration that has a default value. If the value
* referenced by the name cannot be found, the default is used.
*
* @param name
* The name of this piece of configuration.
* @param defaultValue
* The default value for this configuration.
*/
case class WithDefaultValue[A](
name: ConfigName,
defaultValue: () => A
) extends ConfigKey[A]