All Downloads are FREE. Search and download functionalities are using the official Maven repository.

name.remal.classpath.kt Maven / Gradle / Ivy

package name.remal

val CLASS_FILE_NAME_SUFFIX = ".class"

fun classNameToResourceName(className: String) = className.replace('.', '/') + CLASS_FILE_NAME_SUFFIX

fun resourceNameToClassName(resourceName: String): String {
    if (!isClassResourceName(resourceName)) throw IllegalArgumentException("$resourceName is not class-resource")
    return resourceName.substring(0, resourceName.length - CLASS_FILE_NAME_SUFFIX.length).replace('/', '.')
}

fun isClassResourceName(resourceName: String) = resourceName.endsWith(CLASS_FILE_NAME_SUFFIX)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy