All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jp.co.cyberagent.aeromock.config.ServerOption.scala Maven / Gradle / Ivy

There is a newer version: 0.2.5
Show newest version
package jp.co.cyberagent.aeromock.config

import java.nio.file.{Path, Paths}

import jp.co.cyberagent.aeromock.helper._

import scalaz.Scalaz._

class ServerOptionDef {

  type Args4jOption = org.kohsuke.args4j.Option

  @Args4jOption(name = "-p", usage = "listen port")
  var port: String = null

  @Args4jOption(name = "-c", usage = "path of config file")
  var configFile: String = null

}

class ServerOption(val port: Option[Int], val configFile: Option[Path])

object ServerOption {

  def apply(bean: ServerOptionDef): ServerOption = {
    new ServerOption(
      Option(bean.port).flatMap(_.parseInt.toOption),
      Option(bean.configFile).map(p => Paths.get(p).withHomeDirectory())
    )
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy