com.codemettle.akkasnmp4j.config.GetOptions.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of akka-snmp4j_2.11 Show documentation
Show all versions of akka-snmp4j_2.11 Show documentation
Library to aid usage of SNMP4J in Scala + Akka
The newest version!
/*
* GetOptions.scala
*
* Updated: Dec 3, 2014
*
* Copyright (c) 2014, CodeMettle
*/
package com.codemettle.akkasnmp4j.config
import com.typesafe.config.Config
import com.codemettle.akkasnmp4j.util.SettingsCompanion
import scala.concurrent.duration.{Duration, FiniteDuration}
/**
* @author steven
*
*/
case class GetOptions(port: Int, retries: Int, timeout: Option[FiniteDuration])
object GetOptions extends SettingsCompanion[GetOptions]("akkasnmp4j.get-defaults") {
override def fromSubConfig(c: Config): GetOptions = {
apply(
c getInt "port",
c getInt "retries",
Option(c getString "timeout") map (Duration(_)) match {
case Some(fd: FiniteDuration) => Some(fd)
case _ => None
}
)
}
}