AbstractEventEntry builds up aggregate identifier from toString() instead of asString()

Hi there,

I was wondering why by custom aggregate identifier is not saved into a event entry correctly (its string representation); sure I wasn’t extending from AbstractAggregateIdentifier, just implemented the interface, but was expecting that AggregateIdentifier.asString() will be used and not toString() as it is now in the constructor of AbstractEventEntry:

  • this.aggregateIdentifier = event.getAggregateIdentifier().toString(); is now instead of this.aggregateIdentifier = event.getAggregateIdentifier().asString();
    There is no issue if one extends from AbstractAggregateIdentifier, but IMO, asString() would serve its purpose here better. Should I report an issue?

regards,
Catalin

Hi Catalin,

thanks for reporting this. You’re right, it should be asString(). The documentation on AggregateIdentifier states that implementations “MAY” provide the same value in toString and asString, but it isn’t required.

I have reported issue 210 and started work on it immediately.

Cheers,

Allard

Hi Allard,

Great, thx a lot.

cheers,
Catalin