Packages

  • package root
    Definition Classes
    root
  • package de
    Definition Classes
    root
  • package h2b
    Definition Classes
    de
  • package scala
    Definition Classes
    h2b
  • package lib
    Definition Classes
    scala
  • package util

    This is a Scala library of programming utilities.

    This is a Scala library of programming utilities. It is not intended to comprise a systematic collection but contains some tools that may be useful for some applications.

    Some highlights are a number of probability distributions, a command-line interface, a configuration package, an RSS utility, a class to handle temporary directories, control structures, a logger trait and a timer.

    Definition Classes
    lib
  • package cli

    Define the parameters of your command line as instances of

    Define the parameters of your command line as instances of

    - FlagParameter: no specific value, just signals that it is there,

    - HelpParameter: signals that the user needs some help (if given as a command-line argument, other parameters are not computed and no parse exceptions are thrown),

    - ValueParameter[V]: has exactly one value of type V,

    - ListParameter[V]: has a number of values of type V and

    - MainParameter: has a number of String values.

    ValueParameter[V] and ListParameter[V] need a converter to convert a string to the value type V. You might want to import the object Converter that provides converters for standard data types implicitly by:

    import de.h2b.scala.lib.util.cli.Converter._

    Then create a new instance of CommandLine with a set of parameters. The resulting object then can parse a string sequence or an array of strings for parameters and their values. If something goes wrong, either a ParameterException (some argument does not obey to the format specified by its parameter) or a CommandLineException (something is wrong with the arguments as a whole) is thrown.

    Finally query the original parameter instances for its value or values field.

    The usage method of CommandLine constructs a string suitable for a usage message.

    Definition Classes
    util
    Example:
    1. import de.h2b.scala.lib.util.cli._
      import de.h2b.scala.lib.util.cli.Converter._
      val overwrite = FlagParameter(Set("-o", "--overwrite"), "overwrite target")
      val mode = ValueParameter(Set("-m"), "mode", default=Some(0))
      val main = MainParameter("source target", arity=2)
      CommandLine(Set(overwrite, mode, main)).parse("-o -m 1 from to".split(' '))
      println(overwrite.value) //> Some(true)
      println(mode.value) //> Some(1)
      println(main.values) //> Some(WrappedArray(from, to))
  • package config

    This package provides various configuration sources under a common trait Config, which is basically an immutable map.

    This package provides various configuration sources under a common trait Config, which is basically an immutable map. The following implementations are available:

    - ArgsConfig loads key/value pairs from an array of strings: array elements that contain a separator char (defined by ArgsConfig.SeparatorChar) are considered as key/value pairs, while elements not consumed by this rule can be retrieved by the remaining array (makes it suitable to scan a command line for such key/value pairs and parsing the rest with tools like described in [U1 Command-Line Interface](#u1-command-line-interface).

    - FileConfig loads key/value pairs from a specified resource file which must conform to the java.util.Properties#load(InputStream) method; there is also a factory method where the resource is looked up under the modified package name of a specified class.

    - BundleConfig loads key/value pairs from a resource bundle (according to the java.util.ResourceBundle class) of a specified base name using a locale option; there is also a factory method where the resource bundle is looked up under the modified package name of a specified class.

    * SystemPropertiesConfig is a Config object that represents the system properties of the JVM.

    * SystemEnvironmentConfig is a Config object that represents the system environment; note that the system may not support environment variables -- in this case, this object is empty.

    Multiple Configs can be combined using the standard map ++ operators, yielding an overall Config.

    Definition Classes
    util
    Example:
    1. import de.h2b.scala.lib.util.config._
      val argsConfig = ArgsConfig("-x key1=val1 /y key2=val2 abc".split(' '))
      val sysConfig = SystemPropertiesConfig
      val otherConfig = Config("one"->1, "two"->2, "three"->3)
      val config = argsConfig ++ sysConfig ++ otherConfig
      println(config.get("key1")) //> Some(val1)
      println(config.get("java.version")) //> Some(1.8.0_121)
      println(config.get("two")) //> Some(2)
      println(argsConfig.remaining.mkString(" ")) //> -x /y abc
  • Builder
  • ConsoleLogger
  • Control
  • JavaCollectionConverters
  • Level
  • Logger
  • MsTimer
  • NsTimer
  • PerformanceMeter
  • StringCompare
  • StringCompareIgnoreSet
  • StringConv
  • StringOps
  • Timer

trait Logger extends AnyRef

An interface for logging events.

Copyright (C) 2008, 2015 Hans-Hermann Bode

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Logger
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def log(msg: => String): Unit
    Attributes
    protected
  2. abstract val name: String
    Attributes
    protected

Concrete 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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def at(lev: Level): Logger

    Sets the current level of this logger.

    Sets the current level of this logger.

    Since this logger itself is returned by this method, it can be used in a declaration like in the example below.

    lev

    the level

    returns

    this logger

    Example:
    1. val logger = Logger("name") at Level.Debug

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. def config(msg: => String): Unit

    Logs a configuration message.

    Logs a configuration message.

    Elidable at level elidable.CONFIG.

    msg

    the message

    Annotations
    @elidable(elidable.CONFIG)
  8. def debug(msg: => String): Unit

    Logs a debugging message.

    Logs a debugging message.

    Elidable at level elidable.FINE.

    msg

    the message

    Annotations
    @elidable(elidable.FINE)
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def error(msg: => String): Unit

    Logs an error message.

    Logs an error message.

    Elidable at level elidable.SEVERE.

    msg

    the message

    Annotations
    @elidable(elidable.SEVERE)
  12. def fatal(msg: => String): Unit

    Logs a fatal message.

    Logs a fatal message.

    Elidable at level elidable.SEVERE.

    msg

    the message

    Annotations
    @elidable(elidable.SEVERE)
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def info(msg: => String): Unit

    Logs an informational message.

    Logs an informational message.

    Elidable at level elidable.INFO.

    msg

    the message

    Annotations
    @elidable(elidable.INFO)
  16. def isEnabled(lev: Level): Boolean

    States whether a level is enabled for this logger.

    States whether a level is enabled for this logger.

    The level specified is enabled if it is higher than or equal to the current level of this logger.

    lev

    the level

    returns

    true if lev is enabled, false if not

  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. def log(lev: Level, msg: => String): Unit

    Logs a message provided that the particular level specified is higher than or equal to the current level of this logger.

    Logs a message provided that the particular level specified is higher than or equal to the current level of this logger.

    lev

    the level

    msg

    the message

    Note

    In contrast to the individual logging methods like info, debug etc., this method is not elidable.

  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    AnyRef → Any
  24. def trace(msg: => String): Unit

    Logs a tracing message.

    Logs a tracing message.

    Elidable at level elidable.FINER.

    msg

    the message

    Annotations
    @elidable(elidable.FINER)
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. def warn(msg: => String): Unit

    Logs a warning message.

    Logs a warning message.

    Elidable at level elidable.WARNING.

    msg

    the message

    Annotations
    @elidable(elidable.WARNING)

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped