diff options
Diffstat (limited to 'src/main/kotlin/moe/nea/shot/ClassRef.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/shot/ClassRef.kt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/shot/ClassRef.kt b/src/main/kotlin/moe/nea/shot/ClassRef.kt new file mode 100644 index 0000000..6fdd9d1 --- /dev/null +++ b/src/main/kotlin/moe/nea/shot/ClassRef.kt @@ -0,0 +1,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("/", ".")) + } + } +}
\ No newline at end of file |