parse

fun <TYPE : Any, M : Metadata> parse(type: Class<TYPE>): M

Parses metadata for the given class type, utilizing caching to avoid redundant parsing operations. If metadata for the class has already been parsed and cached, returns the cached instance. Otherwise, parses the metadata using parseToMetadata and stores it in the cache.

example:

class MyMetadataParser : CacheableMetadataParser() {
override fun <TYPE : Any, M : Metadata> parseToMetadata(type: Class<TYPE>): M {
// Implementation here
}
}

val parser = MyMetadataParser()
val metadata = parser.parse<MyClass, MyMetadata>(MyClass::class.java)

Return

the parsed metadata of type M

Parameters

TYPE

the type of the class being parsed

M

the specific metadata type being returned

type

the Class object representing the type to parse metadata for

Throws

if the cached metadata cannot be cast to the expected type M