我有这个代码:
val host:String = Play.configuration.getString("auth.ldap.directory.host").get
val port:java.lang.Integer = Play.configuration.getString("auth.ldap.directory.port").get.toInt
val userDNFormat:String = Play.configuration.getString("auth.ldap.userDNFormat").get
我需要向其中添加十几个配置选项,因此我希望将其重构为:
val params = Seq("auth.ldap.directory.host", "auth.ldap.directory.port", "auth.ldap.userDNFormat")
params.map(Play.configuration.getString) match {
case host~port~userDNFormat => foo(host, port, userDNFormat)
}
我编了那个代码。执行此操作的正确语法是什么?在地图/匹配线上我收到了这个错误,我不明白:
error: type mismatch;
found : (String, Option[Set[String]]) => Option[String]
required: java.lang.String => ?