aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/shot/ClassRef.kt
blob: 6fdd9d193e18a82c75ad1e4f1b96d88232d1fa89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package moe.nea.shot

import java.io.Serializable


data class ClassRef(val className: String) : Serializable {
    val path: String get() = "$nudeJvmRef.class"
    val jvmRef: String get() = "L$nudeJvmRef;"
    val nudeJvmRef: String get() = className.replace(".", "/")

    companion object {
        fun fromPath(path: String): ClassRef? {
            if (!path.endsWith(".class")) return null
            return ClassRef(path.removeSuffix(".class").replace("/", "."))
        }
    }
}