trait Config[T] extends () ⇒ T
A config object contains vars for configuring an object of type T, and an apply() method which turns this config into an object of type T.
The trait also contains a few useful implicits.
You can define fields that are required but that don't have a default value with: class BotConfig extends Config[Bot] { var botName = required[String] var botPort = required[Int] .... }
Optional fields can be defined with: var something = optional[Duration]
Fields that are dependent on other fields and have a default value computed from an expression should be marked as computed:
var level = required[Int] var nextLevel = computed { level + 1 }
- Annotations
- @deprecated
- Deprecated
(Since version ) use a Plain Old Scala Object
- Alphabetic
- By Inheritance
- Config
- Function0
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
apply(): T
- Definition Classes
- Function0
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
computed[A](f: ⇒ A): Required[A]
The same as specifying required[A] with a default value, but the intent to the use is slightly different.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- implicit def fromRequired[A](req: Required[A]): A
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- implicit def intoList[A](item: A): List[A]
- implicit def intoOption[A](item: A): Option[A]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
lazy val
memoized: T
a lazy singleton of the configured class.
a lazy singleton of the configured class. Allows one to pass the Config around to multiple classes without producing multiple configured instances
-
def
missingValues: Seq[String]
Looks for any fields that are Required but currently Unspecified, in this object and in any child Config objects, and returns the names of those missing values.
Looks for any fields that are Required but currently Unspecified, in this object and in any child Config objects, and returns the names of those missing values. For missing values in child Config objects, the name is the dot-separated path down to that value.
- Note
as of Scala 2.12 the returned values are not always correct. See
ConfigTest
for an example.
-
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 optional[A](default: ⇒ A): Required[Option[A]]
- def optional[A]: Required[Option[A]]
- def required[A](default: ⇒ A): Required[A]
- def required[A]: Required[A]
-
def
specified[A](value: A): Specified[A]
a non-lazy way to create a Specified that can be called from java
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- implicit def toSpecified[A](value: ⇒ A): Specified[A]
- implicit def toSpecifiedOption[A](value: ⇒ A): Specified[Some[A]]
-
def
toString(): String
- Definition Classes
- Function0 → AnyRef → Any
-
def
validate(): Unit
- Exceptions thrown
RequiredValuesMissing
if there are any missing values.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )