Trait

com.fulcrumgenomics.commons.util

ConfigurationLike

Related Doc: package util

Permalink

trait ConfigurationLike extends AnyRef

Trait that provides useful methods for resolving all kinds of things in configuration. Uses Config to retrieve configuration values in a type-safe way.

The config method must be implemented by a subclass, giving the Config from which to retrieve configuration values.

Overriding the keyRequested method allows a call to be received each time a configuration path is requested.

Overriding the handle method allows a subclass to determine how errors are handled.

Extending the asType method allows a subclass to support additional (possibly custom) types.

The fetch method is used to retrieve configuration values.

Example:
  1. Retrieve a value at a given path:

    scala> import com.fulcrumgenomics.commons.util.ConfigurationLike
    scala> import com.typesafe.config.{Config, ConfigFactory}
    scala> import scala.reflect.runtime.universe.TypeTag
    scala> val conf = new ConfigurationLike {
      val config: Config = ConfigFactory.parseString("""a.str = "string", a.int = 2, a.set = [1,2,3]""")
      def get[T : TypeTag](path: String): Option[T] = fetch[T](path)
    }
    scala> conf.get[String]("a.str")
    res0: Option[String] = Some(string)
    scala> conf.get[Int]("a.int")
    res1: Option[Int] = Some(2)
    scala> conf.get[Set[Int]]("a.set")
    res2: Option[Set[Int]] = Some(Set(1, 2, 3))
    scala> conf.get[Set[Int]]("a.does-not-exist")
    res3: Option[Set[Int]] = None
    scala> conf.get[Int]("a.set")
    java.lang.IllegalArgumentException: Exception retrieving configuration key 'a.set'
    ...
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ConfigurationLike
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def config: Config

    Permalink

    The configuration to query.

    The configuration to query.

    Attributes
    protected

Concrete Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from ConfigurationLike to any2stringadd[ConfigurationLike] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (ConfigurationLike, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from ConfigurationLike to ArrowAssoc[ConfigurationLike] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def asType[T](path: String)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): T

    Permalink

    Converts the configuration path to the given type.

    Converts the configuration path to the given type. If the requested type is not supported, an exception is thrown. Override this method to support custom types.

    Attributes
    protected
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def ensuring(cond: (ConfigurationLike) ⇒ Boolean, msg: ⇒ Any): ConfigurationLike

    Permalink
    Implicit information
    This member is added by an implicit conversion from ConfigurationLike to Ensuring[ConfigurationLike] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: (ConfigurationLike) ⇒ Boolean): ConfigurationLike

    Permalink
    Implicit information
    This member is added by an implicit conversion from ConfigurationLike to Ensuring[ConfigurationLike] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean, msg: ⇒ Any): ConfigurationLike

    Permalink
    Implicit information
    This member is added by an implicit conversion from ConfigurationLike to Ensuring[ConfigurationLike] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean): ConfigurationLike

    Permalink
    Implicit information
    This member is added by an implicit conversion from ConfigurationLike to Ensuring[ConfigurationLike] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  15. def fetch[T](path: String)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Option[T]

    Permalink

    Method to fetch a configuration key that may or may not be present.

    Method to fetch a configuration key that may or may not be present.

    Attributes
    protected
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from ConfigurationLike to StringFormat[ConfigurationLike] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  18. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  19. def handle(message: ⇒ String, throwable: Option[Throwable] = None): Nothing

    Permalink

    Method to allow subclasses to override how errors are handled, e.g.

    Method to allow subclasses to override how errors are handled, e.g. by logging or throwing different exceptions.

    Attributes
    protected
  20. def hashCode(): Int

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

    Permalink
    Definition Classes
    Any
  22. def keyRequested(path: String): Unit

    Permalink

    Method that can be overridden to receive a call each time a configuration path is requested.

    Method that can be overridden to receive a call each time a configuration path is requested.

    Attributes
    protected
  23. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  26. final def synchronized[T0](arg0: ⇒ T0): T0

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. def [B](y: B): (ConfigurationLike, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from ConfigurationLike to ArrowAssoc[ConfigurationLike] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from ConfigurationLike to any2stringadd[ConfigurationLike]

Inherited by implicit conversion StringFormat from ConfigurationLike to StringFormat[ConfigurationLike]

Inherited by implicit conversion Ensuring from ConfigurationLike to Ensuring[ConfigurationLike]

Inherited by implicit conversion ArrowAssoc from ConfigurationLike to ArrowAssoc[ConfigurationLike]

Ungrouped