Package com.opencqrs.framework.types
Class PreconfiguredAssignableClassEventTypeResolver
java.lang.Object
com.opencqrs.framework.types.PreconfiguredAssignableClassEventTypeResolver
- All Implemented Interfaces:
EventTypeResolver
public class PreconfiguredAssignableClassEventTypeResolver
extends Object
implements EventTypeResolver
EventTypeResolver implementation that can be pre-configured using a specific mapping between event types and
Java classes.
This implementation takes into account class assignability and hence
may be used to configure event types for abstract or sealed super classes, as well. This reduces the effort of
maintaining explicit mappings for each subclass, as long as the EventDataMarshaller is capable of
deserializing class hierarchies.
-
Constructor Summary
ConstructorsConstructorDescriptionPreconfiguredAssignableClassEventTypeResolver(Map<String, Class<?>> typesToClasses) -
Method Summary
Modifier and TypeMethodDescriptiongetEventType(Class<?> clazz) Resolves the given event type for the givenClass.Class<?> getJavaClass(String eventType) Resolved the JavaClassfor the given event type.
-
Constructor Details
-
PreconfiguredAssignableClassEventTypeResolver
-
-
Method Details
-
getEventType
Description copied from interface:EventTypeResolverResolves the given event type for the givenClass.- Specified by:
getEventTypein interfaceEventTypeResolver- Parameters:
clazz- the Java eventClassto be resolved- Returns:
- the event type to be used for
EventCandidate.type()orEvent.type()
-
getJavaClass
Description copied from interface:EventTypeResolverResolved the JavaClassfor the given event type.- Specified by:
getJavaClassin interfaceEventTypeResolver- Parameters:
eventType- the event type to be resolved- Returns:
- the Java event
Class
-