20 lines
401 B
Kotlin
20 lines
401 B
Kotlin
package ru.dbotthepony.kstarbound.util
|
|
|
|
class FullJsonPath(val fullPath: String) {
|
|
init {
|
|
val delimers = fullPath.count { it == ':' }
|
|
require(delimers < 2) { "Invalid path: $fullPath" }
|
|
}
|
|
|
|
val path = fullPath.substringBefore(':')
|
|
val subpath: JsonPath
|
|
|
|
init {
|
|
if (path.any { it == ':' }) {
|
|
subpath = JsonPath(fullPath.substringAfter(':'))
|
|
} else {
|
|
subpath = JsonPath.EMPTY
|
|
}
|
|
}
|
|
}
|