Package com.opencqrs.framework.command
Record Class CommandHandlerDefinition<I,C extends Command,R>
java.lang.Object
java.lang.Record
com.opencqrs.framework.command.CommandHandlerDefinition<I,C,R>
- Type Parameters:
I- the generic type of the instance to be event sourced before handling the commandC- the command typeR- the command execution result type- Record Components:
instanceClass- instance type used for state rebuildingcommandClass- command type to be executedhandler- command handler to be executedsourcingMode- the event-sourcing mode for theCommandHandler
public record CommandHandlerDefinition<I,C extends Command,R> (Class<I> instanceClass, Class<C extends Command> commandClass, CommandHandler<I,C extends Command,R> handler, SourcingMode sourcingMode)
extends Record
CommandHandler definition suitable for being processed by the CommandRouter.-
Constructor Summary
ConstructorsConstructorDescriptionCommandHandlerDefinition(Class<I> instanceClazz, Class<C> commandClazz, CommandHandler<I, C, R> commandHandler) Convenience constructor usingSourcingMode.RECURSIVE.CommandHandlerDefinition(Class<I> instanceClass, Class<C> commandClass, CommandHandler<I, C, R> handler, SourcingMode sourcingMode) Creates an instance of aCommandHandlerDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecommandClassrecord component.final booleanIndicates whether some other object is "equal to" this one.handler()Returns the value of thehandlerrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theinstanceClassrecord component.Returns the value of thesourcingModerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CommandHandlerDefinition
public CommandHandlerDefinition(Class<I> instanceClazz, Class<C> commandClazz, CommandHandler<I, C, R> commandHandler) Convenience constructor usingSourcingMode.RECURSIVE.- Parameters:
instanceClazz- instance type used for state rebuildingcommandClazz- command type to be executedcommandHandler- command handler to be executed
-
CommandHandlerDefinition
public CommandHandlerDefinition(Class<I> instanceClass, Class<C> commandClass, CommandHandler<I, C, R> handler, SourcingMode sourcingMode) Creates an instance of aCommandHandlerDefinitionrecord class.- Parameters:
instanceClass- the value for theinstanceClassrecord componentcommandClass- the value for thecommandClassrecord componenthandler- the value for thehandlerrecord componentsourcingMode- the value for thesourcingModerecord 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). -
instanceClass
Returns the value of theinstanceClassrecord component.- Returns:
- the value of the
instanceClassrecord component
-
commandClass
Returns the value of thecommandClassrecord component.- Returns:
- the value of the
commandClassrecord component
-
handler
Returns the value of thehandlerrecord component.- Returns:
- the value of the
handlerrecord component
-
sourcingMode
Returns the value of thesourcingModerecord component.- Returns:
- the value of the
sourcingModerecord component
-