java.lang.ClassCastException:scala.Long $无法强制转换为java.lang.Long

时间:2016-01-26 03:28:32

标签: scala

我收到错误:

  

java.lang.ClassCastException:scala.Long $无法转换为scala中的java.lang.Long问题。

我尝试了各种方法来获得该值

  for (beaconId <- flattenedBeaconList.flatten(flat2).distinct.toList) {
    //val beaconId1 = beaconId.asInstanceOf[Int].asInstanceOf[Long]
    //val beaconId1 = scala.Long.unbox(beaconId)
    //val beaconId1 = Try(beaconId.asInstanceOf[Number].longValue()).toString
    //val beaconId1 = beaconId.m
    val beaconId1: Long = beaconId.asInstanceOf[Long].toLong
    //println("The Beacon ID issssssss::::::" + beaconId1)
    val beacon = dal.Beacons.getById(beaconId1.toLong, brandId)
    //val beaconPayload = dal.Beacons.beaconPayloadByBeaconId(beacon.id.get, brandId).get
    //val beacondIdValue = beaconId.asInstanceOf[Number].longValue()
    //println("Getting called inside the beacon loop::::::::::" + beacondIdValue)
    //val beaconDetails = dal.Beacons.getById(beaconId1, brandId)
    //println("Major value for Beacon is::::::::::" + beaconPayload)
  }

0 个答案:

没有答案