You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment a cast is being done in the Extraction Function to be able to provide it to an object called Transform which has a set of Type Classes for primitive types and collections of them. This is an example of the problem:
private def applyFunction(result: Iterable[Any],keyList: List[(String, String)],limitList: List[(Option[Int], Option[Int], String)], typeClass: Option[String], dotsList: List[String]): Any = {
...
case INTEGER if fExt.isDefined =>
val res: Seq[Int] = result.asInstanceOf[Iterable[Int]].toSeq
Try(Transform.toPrimitive(fExt.get.asInstanceOf[Seq[Int] => Unit], res)) match {
case Success() =>
case Failure() => throw CustomException(s"Type designated doens't correspond with extracted type: Seq[${typeClass.get}]")
}
...
}
The idea is to use Shapeless derivation of generic types to be able to provide the function to the Transform object without casting the function and the value to be applied in the function.
The text was updated successfully, but these errors were encountered:
tiagofiliperdy
changed the title
Casting TypeClasses when applying Extract Function
Casting Generic Function when applying it
May 10, 2018
At the moment a cast is being done in the Extraction Function to be able to provide it to an object called Transform which has a set of Type Classes for primitive types and collections of them. This is an example of the problem:
private def applyFunction(result: Iterable[Any],keyList: List[(String, String)],limitList: List[(Option[Int], Option[Int], String)], typeClass: Option[String], dotsList: List[String]): Any = {
...
case INTEGER if fExt.isDefined =>
val res: Seq[Int] = result.asInstanceOf[Iterable[Int]].toSeq
Try(Transform.toPrimitive(fExt.get.asInstanceOf[Seq[Int] => Unit], res)) match {
case Success() =>
case Failure() => throw CustomException(s"Type designated doens't correspond with extracted type: Seq[${typeClass.get}]")
}
...
}
The idea is to use Shapeless derivation of generic types to be able to provide the function to the Transform object without casting the function and the value to be applied in the function.
The text was updated successfully, but these errors were encountered: