aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/shot/ClassRef.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-01-16 20:38:40 +0100
committerLinnea Gräf <nea@nea.moe>2024-01-16 20:40:53 +0100
commitfb9a3e59af30e698d137d0dd9083059fc404c321 (patch)
tree7f51e077fa3b5871667a930cb71dff54869b5416 /src/main/kotlin/moe/nea/shot/ClassRef.kt
downloadshot-1.0.0.tar.gz
shot-1.0.0.tar.bz2
shot-1.0.0.zip
Initial commitHEAD1.0.0master
Diffstat (limited to 'src/main/kotlin/moe/nea/shot/ClassRef.kt')
-rw-r--r--src/main/kotlin/moe/nea/shot/ClassRef.kt17
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