class Conf extends Serializable with Configurable
Conf is a class that holds data of configuration. Internally, Conf use a ConcurrentHashMap for saving the configuration arguments.
We can instantiate a Conf directly from a Scala Map or a Config from the typesafe config library.
val conf1 = Conf(myMap) // equivalent to Conf.fromMap(myMap) val conf2 = Conf(myConfig) //equivalent to Conf.fromConfig(myConfig)
We can also instantiate manually
val conf3 = new Conf() conf3.set("k", "v") conf3.set(Map("k1" -> "v1", "k2" -> "v2")) conf3 += anotherConf
Configuration arguments can be retrieved by calling the get() method. Conf provide also several implicit converters that handle the type conversion.
For example:
val double = conf.getAs[Double]("dKey") val intArray = conf.getAs[Array[Int]]("aiKey")
- Annotations
- @Evolving()
- Alphabetic
- By Inheritance
- Conf
- Configurable
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Conf()
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def +=(conf: Conf): Conf.this.type
-
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( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
get(key: String, defaultValue: String): String
Get a configuration under the string format
Get a configuration under the string format
- key
Key of the configuration
-
def
get(key: String): Option[String]
Get a configuration under the string format
Get a configuration under the string format
- key
Key of the configuration
- Definition Classes
- Conf → Configurable
-
def
getAs[T](key: String, defaultValue: T)(implicit arg0: Serializer[T]): T
Get a configuration and convert to the given type, return a default value if it's not set
Get a configuration and convert to the given type, return a default value if it's not set
- T
define the type of output
- key
Key of the configuration
-
def
getAs[T](key: String)(implicit converter: Serializer[T]): Option[T]
Get a configuration and convert to the given type, return None if it's not set
Get a configuration and convert to the given type, return None if it's not set
- T
define the type of output
- key
Key of the configuration
- converter
implicit converter
- Annotations
- @throws( ... )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def has(key: String): Boolean
-
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 set[T](key: String, value: T)(implicit converter: Serializer[T]): Conf.this.type
- def set(options: Map[String, String]): Conf.this.type
-
def
set(key: String, value: String): Conf.this.type
- Definition Classes
- Conf → Configurable
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def toMap: Map[String, String]
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
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
- @throws( ... ) @native()