grizzled.config

Configuration

object Configuration

Companion object for the Configuration class

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Configuration
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final val DefaultCommentPattern: Regex

  7. final val DefaultSectionNamePattern: Regex

  8. object Implicits

    Import this object's contents (import Configuration.Implicits._) to get the implicit converters.

  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  20. def read(source: Source, sections: Map[String, Map[String, String]], sectionNamePattern: Regex, commentPattern: Regex): Either[String, Configuration]

    Read a configuration file, permitting some predefined sections to be added to the configuration before it is read.

    Read a configuration file, permitting some predefined sections to be added to the configuration before it is read. The predefined sections are defined in a map of maps. The outer map is keyed by predefined section name. The inner maps consist of options and their values. For instance, to read a configuration file, giving it access to certain command line parameters, you could do something like this:

    object Foo {
    def main(args: Array[String]) = {
      // You'd obviously want to do some real argument checking here.
      val configFile = args(0)
      val name = args(1)
      val ipAddress = args(2)
      val sections = Map("args" -> Map("name" -> name, "ip" -> ipAddress))
      val config = Configuration.read(Source.fromFile(new File(configFile)), sections)
      ...
    }
    }
    source

    scala.io.Source object to read

    sections

    the predefined sections. An empty map means there are no predefined sections. not (true). Default: false

    sectionNamePattern

    Regular expression that matches legal section names.

    commentPattern

    Regular expression that matches comment lines.

    returns

    Success[Configuration] on success, Failure(exception) on error.

  21. def read(source: Source, sections: Map[String, Map[String, String]]): Try[Configuration]

    Read a configuration file, permitting some predefined sections to be added to the configuration before it is read.

    Read a configuration file, permitting some predefined sections to be added to the configuration before it is read. The predefined sections are defined in a map of maps. The outer map is keyed by predefined section name. The inner maps consist of options and their values. For instance, to read a configuration file, giving it access to certain command line parameters, you could do something like this:

    object Foo {
    def main(args: Array[String]) = {
      // You'd obviously want to do some real argument checking here.
      val configFile = args(0)
      val name = args(1)
      val ipAddress = args(2)
      val sections = Map("args" -> Map("name" -> name, "ip" -> ipAddress))
      val config = Configuration.read(Source.fromFile(new File(configFile)), sections)
      ...
    }
    }
    source

    scala.io.Source object to read

    sections

    the predefined sections. An empty map means there are no predefined sections.

    returns

    Success[Configuration] on success, Failure(exception) on error.

  22. def read(source: Source, sectionNamePattern: Regex = ..., commentPattern: Regex = Configuration.DefaultCommentPattern, normalizeOptionName: (String) ⇒ String = DefaultOptionNameTransformer, notFoundFunction: Option[(String, String) ⇒ Try[Option[String]]] = None, safe: Boolean = true): Try[Configuration]

    Read a configuration file, returning an Either, instead of throwing an exception on error.

    Read a configuration file, returning an Either, instead of throwing an exception on error.

    source

    scala.io.Source object to read

    sectionNamePattern

    Regular expression that matches legal section names. Defaults as described above.

    commentPattern

    Regular expression that matches comment lines. Default: "^\s*(#.*)$"

    normalizeOptionName

    Partial function used to transform option names into keys. The default function transforms the names to lower case.

    notFoundFunction

    a function to call if an option isn't found in the configuration, or None. The function must take a section name and an option name as parameters. It must return Failure on error, Success(None) if the value isn't found, and Success Right(Some(string)) if the value is found.

    safe

    true does "safe" substitutions, with substitutions of nonexistent values replaced by empty strings. false ensures that bad substitutions result in errors (or None in functions, like get(), that return Option values).

    returns

    Success(config) on success, Failure(exception) on error.

  23. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  24. def toString(): String

    Definition Classes
    AnyRef → Any
  25. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def apply(source: Source, sections: Map[String, Map[String, String]], sectionNamePattern: Regex, commentPattern: Regex): Either[String, Configuration]

    Read a configuration file, permitting some predefined sections to be added to the configuration before it is read.

    Read a configuration file, permitting some predefined sections to be added to the configuration before it is read. The predefined sections are defined in a map of maps. The outer map is keyed by predefined section name. The inner maps consist of options and their values. For instance, to read a configuration file, giving it access to certain command line parameters, you could do something like this:

    object Foo {
    def main(args: Array[String]) = {
      // You'd obviously want to do some real argument checking here.
      val configFile = args(0)
      val name = args(1)
      val ipAddress = args(2)
      val sections = Map("args" -> Map("name" -> name, "ip" -> ipAddress))
      val config = Configuration(Source.fromFile(new File(configFile)), sections)
      ...
    }
    }
    source

    scala.io.Source object to read

    sections

    the predefined sections. An empty map means there are no predefined sections. not (true). Default: false

    sectionNamePattern

    Regular expression that matches legal section names.

    commentPattern

    Regular expression that matches comment lines.

    returns

    Right(config) on success, Left(error) on error.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.2.0) Use Configuration.read(), instead.

  2. def apply(source: Source, sections: Map[String, Map[String, String]]): Either[String, Configuration]

    Read a configuration file, permitting some predefined sections to be added to the configuration before it is read.

    Read a configuration file, permitting some predefined sections to be added to the configuration before it is read. The predefined sections are defined in a map of maps. The outer map is keyed by predefined section name. The inner maps consist of options and their values. For instance, to read a configuration file, giving it access to certain command line parameters, you could do something like this:

    object Foo {
    def main(args: Array[String]) = {
      // You'd obviously want to do some real argument checking here.
      val configFile = args(0)
      val name = args(1)
      val ipAddress = args(2)
      val sections = Map("args" -> Map("name" -> name, "ip" -> ipAddress))
      val config = Configuration(Source.fromFile(new File(configFile)), sections)
      ...
    }
    }
    source

    scala.io.Source object to read

    sections

    the predefined sections. An empty map means there are no predefined sections.

    returns

    Right[Configuration] on success, Left(error) on error.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.2.0) Use Configuration.read(), instead.

  3. def apply(source: Source, sectionNamePattern: Regex = ..., commentPattern: Regex = Configuration.DefaultCommentPattern, normalizeOptionName: (String) ⇒ String = DefaultOptionNameTransformer, notFoundFunction: Option[(String, String) ⇒ Try[Option[String]]] = None, safe: Boolean = true): Either[String, Configuration]

    Read a configuration file, returning an Either, instead of throwing an exception on error.

    Read a configuration file, returning an Either, instead of throwing an exception on error.

    source

    scala.io.Source object to read

    sectionNamePattern

    Regular expression that matches legal section names. Defaults as described above.

    commentPattern

    Regular expression that matches comment lines. Default: "^\s*(#.*)$"

    normalizeOptionName

    Partial function used to transform option names into keys. The default function transforms the names to lower case.

    notFoundFunction

    a function to call if an option isn't found in the configuration, or None. The function must take a section name and an option name as parameters. It must return Failure on error, Success(None) if the value isn't found, and Success Right(Some(string)) if the value is found.

    safe

    true does "safe" substitutions, with substitutions of nonexistent values replaced by empty strings. false ensures that bad substitutions result in errors (or None in functions, like get(), that return Option values).

    returns

    Right(config) on success, Left(error) on error.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.2.0) Use Configuration.read(), instead.

Inherited from AnyRef

Inherited from Any

Ungrouped