diff --git a/src/main/kotlin/org/rooftop/netx/api/SagaEvent.kt b/src/main/kotlin/org/rooftop/netx/api/SagaEvent.kt index 02012d9..988c3ab 100644 --- a/src/main/kotlin/org/rooftop/netx/api/SagaEvent.kt +++ b/src/main/kotlin/org/rooftop/netx/api/SagaEvent.kt @@ -16,6 +16,12 @@ sealed class SagaEvent( return event } + fun decodeEvent(typeReference: TypeReference): T = + codec.decode( + event ?: throw NullPointerException("Cannot decode event cause event is null"), + typeReference + ) + fun decodeEvent(type: Class): T = decodeEvent(type.kotlin) fun decodeEvent(type: KClass): T =