io.lsdconsulting.interceptors.http.naming.RegexResolvingNameMapper.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lsd-interceptors Show documentation
Show all versions of lsd-interceptors Show documentation
Provides various interceptors to capture events for the lsd-core library to generate sequence diagrams
package io.lsdconsulting.interceptors.http.naming
private const val FIRST_PART_OF_PATH = "^/?(.*?)([/?].*|$)"
class RegexResolvingNameMapper : DestinationNameMappings {
override fun mapForPath(path: String): String = path
.replaceFirst(FIRST_PART_OF_PATH.toRegex(), "$1")
override fun equals(other: Any?): Boolean {
if (this === other) return true
return javaClass == other?.javaClass
}
override fun hashCode(): Int {
return javaClass.hashCode()
}
}