Record Class EventHandlerDefinition<E>
java.lang.Object
java.lang.Record
com.opencqrs.framework.eventhandler.EventHandlerDefinition<E>
- Type Parameters:
E
- the generic Java event type- Record Components:
group
- group identifier forEventHandler
belonging to the same processing groupeventClass
- the Java event type to be handled, may beObject
to handle all eventshandler
- the actual event handler
public record EventHandlerDefinition<E>(@NotBlank String group, @NotNull Class<E> eventClass, @NotNull EventHandler<E> handler)
extends Record
EventHandler
definition suitable for being processed by an event processor.-
Constructor Summary
ConstructorsConstructorDescriptionEventHandlerDefinition
(@NotBlank String group, @NotNull Class<E> eventClass, @NotNull EventHandler<E> handler) Creates an instance of aEventHandlerDefinition
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.Returns the value of theeventClass
record component.@NotBlank String
group()
Returns the value of thegroup
record component.@NotNull EventHandler
<E> handler()
Returns the value of thehandler
record component.final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
EventHandlerDefinition
public EventHandlerDefinition(@NotBlank @NotBlank String group, @NotNull @NotNull Class<E> eventClass, @NotNull @NotNull EventHandler<E> handler) Creates an instance of aEventHandlerDefinition
record class.- Parameters:
group
- the value for thegroup
record componenteventClass
- the value for theeventClass
record componenthandler
- the value for thehandler
record component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
group
Returns the value of thegroup
record component.- Returns:
- the value of the
group
record component
-
eventClass
Returns the value of theeventClass
record component.- Returns:
- the value of the
eventClass
record component
-
handler
Returns the value of thehandler
record component.- Returns:
- the value of the
handler
record component
-