Created
May 24, 2018 09:51
-
-
Save gvolpe/aeb72c0f6a5ba08f491a83399289ad78 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
type Arguments = Args[A] forSome { type A } | |
final class Args[A: SafeArgument](val underlying: Map[String, A]) | |
object Arguments { | |
def empty: ArgumentsAlt[String] = new ArgumentsAlt(Map.empty) | |
def apply[V: SafeArgument](kv: (String, V)*): ArgumentsAlt[V] = | |
new ArgumentsAlt(kv.toMap) | |
} | |
implicit def argumentConversion[A](arguments: ArgumentsAlt[A])(implicit ev: Evidence[SafeArgument]): java.util.Map[String, Object] = | |
arguments.underlying.map { case (k, v) => k -> SafeArgument[A].toObject(v) }.asJava |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment