TelemetryTypeHandlers

The TelemetryTypeHandlers of a TelemetryRegistry, by the type they handle.

A handler applies to its type and to every subtype. For a value, the handler registered for the nearest type wins: its own class, then its superclasses from the closest, then its interfaces. A handler beats the value's own TelemetryLoggable, like a Comparator beats natural ordering, but not the types that always have a fixed encoding, such as numbers, strings and primitive arrays.

Handlers for Measure are registered by default.

Functions

Link copied to clipboard

Returns the handler for values of type, or null if there isn't one.

Link copied to clipboard
inline fun <T : Any> register(handler: TelemetryTypeHandler<T>)

Uses handler for values of T and its subtypes, replacing the one registered for T.

fun <T : Any> register(type: KClass<T>, handler: TelemetryTypeHandler<T>)

Uses handler for values of type and its subtypes, replacing the one registered for type.

Link copied to clipboard
fun unregister(type: KClass<*>)

Stops using the handler registered for type, if any.