Object/Class

grizzled.config

Configuration

Related Docs: class Configuration | package config

Permalink

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
Visibility
  1. Public
  2. All

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final val DefaultCommentPattern: Regex

    Permalink
  5. final val DefaultSectionNamePattern: Regex

    Permalink
  6. object Implicits

    Permalink

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

  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

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

    Permalink

    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.

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

    Permalink

    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.

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

    Permalink

    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.

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

    Permalink
    Definition Classes
    AnyRef
  22. def toString(): String

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

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

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

    Permalink
    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]

    Permalink

    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]

    Permalink

    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[NotFoundFunction] = None, safe: Boolean = true): Either[String, Configuration]

    Permalink

    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