TypeNameMapper

Thread-safe utility for mapping fully qualified class names to Class objects with caching. This object provides efficient type resolution by caching Class instances to avoid repeated Class.forName() calls, which can be expensive.

The mapper uses a ConcurrentHashMap to ensure thread-safe operations and lazy loading of Class objects only when first requested.

Functions

Link copied to clipboard
fun <T> String.toType(): Class<T>

Converts a fully qualified class name string to its corresponding Class object. The result is cached for future lookups to improve performance.