blob: ad605e92219a8f33825ee2e296645ffedda21049 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package xyz.driver.pdsuicommon.utils
import java.time.LocalDateTime
object Utils {
implicit val localDateTimeOrdering: Ordering[LocalDateTime] = Ordering.fromLessThan(_ isBefore _)
/**
* Hack to avoid scala compiler bug with getSimpleName
* @see https://issues.scala-lang.org/browse/SI-2034
*/
def getClassSimpleName(klass: Class[_]): String = {
try {
klass.getSimpleName
} catch {
case _: InternalError =>
val fullName = klass.getName.stripSuffix("$")
val fullClassName = fullName.substring(fullName.lastIndexOf(".") + 1)
fullClassName.substring(fullClassName.lastIndexOf("$") + 1)
}
}
}
|