Packages

  • package root
    Definition Classes
    root
  • package grizzled

    The Grizzled Scala Library contains a variety of miscellaneous, general purpose utility classes and objects.

    The Grizzled Scala Library contains a variety of miscellaneous, general purpose utility classes and objects.

    The home page for the Grizzled Scala Library is http://software.clapper.org/grizzled-scala/. Please see that page for complete details, including installation instructions.

    Definition Classes
    root
  • package config

    Classes and objects to aid in the parsing of INI-style configuration files.

    Classes and objects to aid in the parsing of INI-style configuration files. This package is similar, in concept, to the Python ConfigParser module (though its implementation and capabilities differ quite a bit).

    Definition Classes
    grizzled
  • Configuration
  • ConfigurationException
  • ConfigurationOptionException
  • Section
  • ValueConverter

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
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val DefaultCommentPattern: Regex
  5. val DefaultSectionNamePattern: Regex
  6. 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.

  7. 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.

  8. def apply(source: Source, sectionNamePattern: Regex = ..., commentPattern: Regex = Configuration.DefaultCommentPattern, normalizeOptionName: (String) ⇒ String = DefaultOptionNameTransformer, notFoundFunction: Option[NotFoundFunction] = 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.

  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @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
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  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
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  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[NotFoundFunction] = 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
    @native() @throws( ... )
  28. object Implicits

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

Inherited from AnyRef

Inherited from Any

Ungrouped