-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from ua-parser/drop-old-scala
Drop support for scala 2.10 and 2.11
- Loading branch information
Showing
10 changed files
with
57 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.uaparser | ||
|
||
package object scala { | ||
object jdk { | ||
val CollectionConverters = _root_.scala.collection.JavaConverters | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.uaparser | ||
|
||
package object scala { | ||
object jdk { | ||
val CollectionConverters = _root_.scala.jdk.CollectionConverters | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.uaparser | ||
|
||
package object scala { | ||
object jdk { | ||
val CollectionConverters = _root_.scala.jdk.CollectionConverters | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.uaparser.scala | ||
|
||
import java.io.InputStream | ||
import java.util.{List => JList, Map => JMap} | ||
import jdk.CollectionConverters._ | ||
import org.yaml.snakeyaml.{LoaderOptions, Yaml} | ||
import org.yaml.snakeyaml.constructor.SafeConstructor | ||
|
||
private[scala] object YamlUtil { | ||
def loadYamlAsMap(yamlStream: InputStream, loader: Yaml): Map[String, List[Map[String, String]]] = { | ||
val javaConfig = loader.load[JMap[String, JList[JMap[String, String]]]](yamlStream) | ||
javaConfig.asScala.map { case (k, v) => | ||
k -> v.asScala.map(_.asScala.filter{case (_, v) => v != null}.toMap).toList | ||
}.toMap | ||
} | ||
|
||
def loadYamlAsMap(yamlStream: InputStream): Map[String, List[Map[String, String]]] = { | ||
loadYamlAsMap(yamlStream, new Yaml(new SafeConstructor(new LoaderOptions))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters