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 for EventHandler belonging to the same processing group
eventClass - the Java event type to be handled, may be Object to handle all events
handler - 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 Details

    • EventHandlerDefinition

      public EventHandlerDefinition(@NotBlank @NotBlank String group, @NotNull @NotNull Class<E> eventClass, @NotNull @NotNull EventHandler<E> handler)
      Creates an instance of a EventHandlerDefinition record class.
      Parameters:
      group - the value for the group record component
      eventClass - the value for the eventClass record component
      handler - the value for the handler record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • group

      @NotBlank public @NotBlank String group()
      Returns the value of the group record component.
      Returns:
      the value of the group record component
    • eventClass

      @NotNull public @NotNull Class<E> eventClass()
      Returns the value of the eventClass record component.
      Returns:
      the value of the eventClass record component
    • handler

      @NotNull public @NotNull EventHandler<E> handler()
      Returns the value of the handler record component.
      Returns:
      the value of the handler record component