trait ConfigSource extends AnyRef
- Self Type
- ConfigSource
- Alphabetic
- By Inheritance
- ConfigSource
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def getConfigValue(keys: List[ConfigSourceModule.K]): PropertyTree[ConfigSourceModule.K, ConfigSourceModule.V]
- abstract def leafForSequence: LeafForSequence
- abstract def names: Set[ConfigSourceName]
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def <>(that: => ConfigSource): ConfigSource
<>
is an alias toorElse
.<>
is an alias toorElse
. Trythis
(configSource
), and if it fails, trythat
(configSource
)For example:
Given three configSources,
configSource1
,configSource2
andconfigSource3
, such that configSource1 and configSource2 will only haveid
andconfigSource3
act as a global fall-back source.The following config tries to fetch
Id
from configSource1, and if fails, it triesconfigSource2
, and if both fails it gets fromconfigSource3
.Age
will be fetched only fromconfigSource3
.val config = (string("Id") from (configSource1 orElse configSource2) |@| int("Age"))(Person.apply, Person.unapply) read(config from configSource3)
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def convertKeys(f: (ConfigSourceModule.K) => ConfigSourceModule.K): ConfigSource
Convert the keys before it is queried from ConfigSource.
Convert the keys before it is queried from ConfigSource.
For example:
Given two configSources,
configSource1
andconfigSource2
, such that configSource1 can have uppercase ID and lowercase age, and configSource2 can have lowercase ID and uppercase age.The following solution will not help here, as you would imagine.
config.mapKeys(_.toUpperCase) from configSource1 orElse config.mapKeys(_.toLowerCase) from configSource2)
A correct solution here would be the following, indicating the fact
configSources
act differently for different fields.val idSource = configSource1.convertKeys(_.toUpperCase) <> configSource2.convertKeys(_.toLowerCase) val ageSource = configSource1.convertKeys(_.toLowerCase) <> configSource2.convertKeys(_.toUpperCase) val config = (string("Id") from idSource |@| int("Age") from ageSource)(Person.apply, Person.unapply) read(config)
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def orElse(that: => ConfigSource): ConfigSource
Try
this
(configSource
), and if it fails, trythat
(configSource
)Try
this
(configSource
), and if it fails, trythat
(configSource
)For example:
Given three configSources,
configSource1
,configSource2
andconfigSource3
, such that configSource1 and configSource2 will only haveid
andconfigSource3
act as a global fall-back source.The following config tries to fetch
Id
from configSource1, and if fails, it triesconfigSource2
, and if both fails it gets fromconfigSource3
.Age
will be fetched only fromconfigSource3
.val config = (string("Id") from (configSource1 orElse configSource2) |@| int("Age"))(Person.apply, Person.unapply) read(config from configSource3)
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()