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 aCommandHandlerDefinition
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecommandClass
record component.final boolean
Indicates whether some other object is "equal to" this one.handler()
Returns the value of thehandler
record component.final int
hashCode()
Returns a hash code value for this object.Returns the value of theinstanceClass
record component.Returns the value of thesourcingMode
record component.final String
toString()
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 aCommandHandlerDefinition
record class.- Parameters:
instanceClass
- the value for theinstanceClass
record componentcommandClass
- the value for thecommandClass
record componenthandler
- the value for thehandler
record componentsourcingMode
- the value for thesourcingMode
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)
. -
instanceClass
Returns the value of theinstanceClass
record component.- Returns:
- the value of the
instanceClass
record component
-
commandClass
Returns the value of thecommandClass
record component.- Returns:
- the value of the
commandClass
record component
-
handler
Returns the value of thehandler
record component.- Returns:
- the value of the
handler
record component
-
sourcingMode
Returns the value of thesourcingMode
record component.- Returns:
- the value of the
sourcingMode
record component
-