class DomainEvent {
}
and then I have different events with following structure:
class SomeEvent extend DomainEvent {
private UUID orderId;
private UUID orderlineId;
private UUID productId;
}
Now lets say that I have 20 such events and most of them have orderId + orderLineID as attributes som have in addition productID.
There are also some events that are not oriented around the Order , so they may have differnt fields.
In the begining I though mayve I can create
abstract AbstractOrderEvent extends DomainEvent {
private UUIID orderId;
}
and then
abstract AbstractOrderLineEvent extends AbstractOrderEvent {
private UUID orderlineId;
}
and then
abstract AbstractProductEvent extends AbstractOrderLineEvent {}
But it looks to me plain ugly! Maybe my own taste.
Then I thought maybe I can do the same with interfaces. But to be honest it does not look much better.
I also thought to have something like
DomainEvent<T extends Subject> {
T subject ( and then the subject to has different attributes)
}
and then I can have something like
OrderCompleytedEvent extends DomainEvent {
}
How can I model this case ?
Right now one event results on one or more methods registered under the three refreshers. Lets put it this way which is unnessesary as it does not matter which event is it as long as it contains orderId and/or orderlineId and/or productilneId
– Pesho Feb 15 '21 at 20:07